Skip to content

Commit

Permalink
Warn in console when timeout=undefined and throwOnTimeout=true
Browse files Browse the repository at this point in the history
  • Loading branch information
lukehorvat committed Jun 21, 2024
1 parent 0d8fcb6 commit 520dc1b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions source/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,10 @@ export default class PQueue<QueueType extends Queue<RunFunction, EnqueueOptionsT
...options,
};

if (!options.timeout && options.throwOnTimeout) {
console.warn('You specified `throwOnTimeout=true` without defining `timeout`.');
}

return new Promise((resolve, reject) => {
this.#queue.enqueue(async () => {
this.#pending++;
Expand Down

0 comments on commit 520dc1b

Please sign in to comment.