NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
npm
npm, #1643 most downloaded on npm
Promise queue with concurrency control
Latest stable
10.0.0
Last release 1 months ago
12 Oct 2026
Ships unpredictably
gaps range from 2 weeks to 1.1 years
Most releases are documented
notes for 45 of 59 stable releases
Nothing withdrawn
no release was ever pulled
10 years old
59 releases · first in 2016
Drag across the ruler to compare, or tap a release to open it.
Remove the deprecated carryoverConcurrencyCount option: use carryoverIntervalCount 300a52d
EventTarget instead of an EventEmitter 300a52d
.addEventListener() and .removeEventListener() instead of .on(), .once(), .off(), and the other EventEmitter methods.completed and error events have the result or the error in event.detail..clear() now rejects the promises of the removed tasks with an AbortError instead of leaving them pending forever 64311ff
.clear() marks these promises as handled, but a promise made from them, like the one from .addAll() or queue.add(fn).then(…), now rejects, so handle it.TimeoutError is now a DOMException named TimeoutError, like the error of AbortSignal.timeout() 300a52dcarryoverConcurrencyCount option: use carryoverIntervalCount 300a52dconcurrency and intervalCap must be integers (or Infinity). A limit of 1.5 used to let 2 tasks run.timeout and interval above 2147483647 ms (the maximum timer delay) are rejected. They used to fire after 1 ms..add() rejects with a TypeError when priority is NaN or not a number..start(), .clear(), and setting concurrency no longer emit empty and idle when the queue is already empty, so idle no longer fires on a queue that never had a task aeedf53queueClass must now implement remove() 300a52d.add() call, so it sees the AsyncLocalStorage values of the caller, also when it starts later (Node.js 22.3 and later, Deno, and Bun) (#200) a5b7b54
timeout now gets a signal that aborts when the task times out, so you can pass it on to fetch() and similar to stop the work 300a52d.onEmpty() and the empty event now fire when the last waiting task starts, not when the next task finishes 1cf5b82 cb25a0a.addAll() now resolves with a typed tuple when the tasks return different types 36e83aaintervalCap was exceeded at the end of a window, a waiting task got stuck, or isRateLimited was wrong 6af55a7 1cf5b82 6c08a4f ac89911 450356aPriorityQueue keeping finished tasks in memory 95622a4 6fb8337idle listener and events in the wrong order aeedf53 b33dd44 8792846 e79f970 d65d567 6f6028aundefined options and an invalid .timeout setter breaking the queue d6cf96b 48586f4-queue.on('completed', result => {
- console.log(result);
-});
+queue.addEventListener('completed', event => {
+ console.log(event.detail);
+});
-queue.once('idle', () => {});
+queue.addEventListener('idle', () => {}, {once: true});
If the result or the error is undefined, event.detail is null, because CustomEvent works that way.
Other differences from EventEmitter:
.clear()The promises of the removed tasks now reject with an AbortError. If you await them, handle the rejection:
const results = await queue.addAll(tasks).catch(error => {
if (error.name === 'AbortError') {
return [];
}
throw error;
});
error instanceof TimeoutError still works. You can also check error.name === 'TimeoutError', which also matches the error of AbortSignal.timeout().
Other changes:
TimeoutError stack trace no longer shows where the task was added.timeout set, the task's signal is no longer linked to your signal after the task finishes.signal or timeout settle 2 microtasks later than before.https://github.com/sindresorhus/p-queue/compare/v9.3.5...v10.0.0
Your coding agent can read these notes before it upgrades. Set up the MCP server →
Fix missed abort when the task aborts the signal while it starts 507e7ee
https://github.com/sindresorhus/p-queue/compare/v9.3.4...v9.3.5
Count the running task before emitting active 22edad4
https://github.com/sindresorhus/p-queue/compare/v9.3.3...v9.3.4
Fix rate limiter delaying tasks in a fresh window when intervalCap > 1 89a10bb
intervalCap > 1 89a10bbhttps://github.com/sindresorhus/p-queue/compare/v9.3.2...v9.3.3
Fix per-task timeout validation 9efde42
https://github.com/sindresorhus/p-queue/compare/v9.3.1...v9.3.2
Fix onSizeLessThan() resolving late when the queue drains without a completion d9cf2be
onSizeLessThan() resolving late when the queue drains without a completion d9cf2behttps://github.com/sindresorhus/p-queue/compare/v9.3.0...v9.3.1
Add timeoutRemaining to runningTasks 57d0a1a
timeoutRemaining to runningTasks 57d0a1ahttps://github.com/sindresorhus/p-queue/compare/v9.2.0...v9.3.0
Improve performance (#244) 87077d0
https://github.com/sindresorhus/p-queue/compare/v9.1.2...v9.2.0
Fix: Export PriorityQueue type (#242) a20e1f3
PriorityQueue type (#242) a20e1f3https://github.com/sindresorhus/p-queue/compare/v9.1.1...v9.1.2
Fix signal option not rejecting when task is aborted while queued a64b316
signal option not rejecting when task is aborted while queued a64b316
remove() method. See the built-in class.https://github.com/sindresorhus/p-queue/compare/v9.1.0...v9.1.1
Add `strict` option for sliding window rate limiting 03b8156
strict option for sliding window rate limiting 03b8156https://github.com/sindresorhus/p-queue/compare/v9.0.1...v9.1.0
Fix: Remove abort listener when operation completes (#235) e9074f0
https://github.com/sindresorhus/p-queue/compare/v9.0.0...v9.0.1
Remove throwOnTimeout option - timeouts now always throw e48716f
throwOnTimeout option - timeouts now always throw e48716f
const result = await queue.add(fn).catch(error => {
if (error instanceof TimeoutError) {
return undefined;
}
throw error;
});
carryoverConcurrencyCount option to carryoverIntervalCount a6096de
.onError() 7c27e1d.onPendingZero() (#230) 62efb74pendingZero event (#230) 62efb74.runningTasks fad8ee4.isSaturated fad8ee4.onRateLimit() 701453e.onRateLimitCleared() 701453e.isRateLimited 701453erateLimit event 701453erateLimitCleared event 701453ehttps://github.com/sindresorhus/p-queue/compare/v8.1.1...v9.0.0
Don't count aborted jobs in intervalCount (#220) 199614e
intervalCount (#220) 199614ehttps://github.com/sindresorhus/p-queue/compare/v8.1.0...v8.1.1
Add `.setPriority()` for updating priority of a queued promise function (#209) 6e5cbc9
.setPriority() for updating priority of a queued promise function (#209) 6e5cbc9https://github.com/sindresorhus/p-queue/compare/v8.0.1...v8.1.0
Fix TypeScript types for when tsconfig exactOptionalPropertyTypes is enabled (#202) ec4e2a3
exactOptionalPropertyTypes is enabled (#202) ec4e2a3https://github.com/sindresorhus/p-queue/compare/v8.0.0...v8.0.1
Removed the AbortError export. It now throws the built-in DOMException when using the signal option. 68dfe95
AbortError export. It now throws the built-in DOMException when using the signal option. 68dfe95DefaultAddOptions type to QueueAddOptionshttps://github.com/sindresorhus/p-queue/compare/v7.4.1...v8.0.0
Fix problem with importing into TypeScript project https://github.com/sindresorhus/p-queue/commit/9f7ad20d55c4e7324762f5624f773f73fa99e76c
https://github.com/sindresorhus/p-queue/compare/v7.4.0...v7.4.1
https://github.com/sindresorhus/p-queue/compare/v7.3.4...v7.4.0
https://github.com/sindresorhus/p-queue/compare/v7.3.4...v7.4.0
https://github.com/sindresorhus/p-queue/compare/v7.3.3...v7.3.4
https://github.com/sindresorhus/p-queue/compare/v7.3.3...v7.3.4
https://github.com/sindresorhus/p-queue/compare/v7.3.2...v7.3.3
https://github.com/sindresorhus/p-queue/compare/v7.3.2...v7.3.3
https://github.com/sindresorhus/p-queue/compare/v7.3.1...v7.3.2
https://github.com/sindresorhus/p-queue/compare/v7.3.1...v7.3.2
Fix .add() and .addAll() 8184655
.add() and .addAll() 8184655https://github.com/sindresorhus/p-queue/compare/v7.3.0...v7.3.1
https://github.com/sindresorhus/p-queue/compare/v7.2.0...v7.3.0
empty event 5362aa7https://github.com/sindresorhus/p-queue/compare/v7.2.0...v7.3.0
Support `AbortController` (#161) 394153f
AbortController (#161) 394153fhttps://github.com/sindresorhus/p-queue/compare/v7.1.0...v7.2.0
https://github.com/sindresorhus/p-queue/compare/v7.0.0...v7.1.0
https://github.com/sindresorhus/p-queue/compare/v7.0.0...v7.1.0
This package is now pure ESM. Please read this.
error & completed events (#130) a176837.onSizeLessThan() helper method (#131) 8d0a356https://github.com/sindresorhus/p-queue/compare/v6.6.2...v7.0.0
Fix obscure unhandled rejection when calling .clear() 933ea23
.clear() 933ea23https://github.com/sindresorhus/p-queue/compare/v6.6.1...v6.6.2
Improve import for VS Code a81be14
https://github.com/sindresorhus/p-queue/compare/v6.6.0...v6.6.1
Add add and next events (#111) edd2e8a
add and next events (#111) edd2e8ahttps://github.com/sindresorhus/p-queue/compare/v6.5.0...v6.6.0
Update to TypeScript 3.9 4b4d2fa b4f2158
https://github.com/sindresorhus/p-queue/compare/v6.4.0...v6.5.0
https://github.com/sindresorhus/p-queue/compare/v6.3.0...v6.4.0
idle event (#109) 54a017bhttps://github.com/sindresorhus/p-queue/compare/v6.3.0...v6.4.0
Add .sizeBy() method to find queue size by priority (#94) a9f5778 If you implement your own queue, you need to implement the filter method to use .siz
.sizeBy() method to find queue size by priority (#94) a9f5778
If you implement your own queue, you need to implement the filter method to use .sizeBy().https://github.com/sindresorhus/p-queue/compare/v6.2.1...v6.3.0
Fix problem with TimeoutError import (#88) db039dd
TimeoutError import (#88) db039ddhttps://github.com/sindresorhus/p-queue/compare/v6.2.0...v6.2.1
Don't include source maps in the package f79384b They were broken anyway and it doesn't have much value for TS as it compiles to readable JS.
https://github.com/sindresorhus/p-queue/compare/v6.1.1...v6.2.0
Fix typo in options logic when adding a task (#81) 90acaf2
https://github.com/sindresorhus/p-queue/compare/v6.1.0...v6.1.1
Add ability to update concurrency (#52) bc75c25
Enhancements:
.start() return the instance (#63) a347a6cFixes:
throwOnTimeout option (#75) 5e3f629https://github.com/sindresorhus/p-queue/compare/v6.0.2...v6.1.0
TypeScript - Properly export interfaces (#72) 6082a01
https://github.com/sindresorhus/p-queue/compare/v6.0.1...v6.0.2
Add missing package.json main field (#69) ed606e8
https://github.com/sindresorhus/p-queue/compare/v6.0.0...v6.0.1
Rewrite in TypeScript (#60) a9d3ad9 Note: This means that CommonJS users needs to import the package using: const {default: pQueue} = require('p-queue
Breaking:
const {default: pQueue} = require('p-queue');Enhancements:
https://github.com/sindresorhus/p-queue/compare/v5.0.0...v6.0.0
Require Node.js 8 https://github.com/sindresorhus/p-queue/commit/7ce42b317f950ca3a97eb9025deb64b63add7ac3
Breaking:
import pQueue from 'p-queue'; to import pQueue = require('p-queue');Use eventemitter3 module instead of Node.js EventEmitter (#58) 3827527 *(It's only a breaking change if you depend on EventEmitter methods that are no…
Breaking:
eventemitter3 module instead of Node.js EventEmitter (#58) 3827527
(It's only a breaking change if you depend on EventEmitter methods that are not available in eventemitter3. Read more)https://github.com/sindresorhus/p-queue/compare/v3.2.0...v4.0.0
Add TypeScript definition (#57) 6e9b998
https://github.com/sindresorhus/p-queue/compare/v3.1.0...v3.2.0
https://github.com/sindresorhus/p-queue/compare/v3.0.0...v3.1.0
active event (#49) 16f3928https://github.com/sindresorhus/p-queue/compare/v3.0.0...v3.1.0
Require Node.js 6 https://github.com/sindresorhus/p-queue/commit/d573a971fa7f7658f2169a8621aeef6fb1099502
Breaking:
Other:
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
One column per quarter.