Fix setting an invalid `.timeout` on the queue making every later `.a… · sindresorhus/p-queue@48586f4 · GitHub
Skip to content

Commit 48586f4

Browse files
committed
Fix setting an invalid .timeout on the queue making every later .add() reject
Previously, `queue.timeout` was a plain field, so `queue.timeout = 0` (or a negative, `NaN`, or too large value) was accepted without an error, and then every `.add()` without its own `timeout` rejected with a `TypeError`. The setter now throws, like the constructor and the `concurrency` setter, and keeps the previous value.
1 parent 9310cd1 commit 48586f4

2 files changed

Lines changed: 53 additions & 18 deletions

File tree

‎source/index.ts‎

Lines changed: 22 additions & 15 deletions

‎test/validation.ts‎

Lines changed: 31 additions & 3 deletions

0 commit comments

Comments
 (0)