finds.dev← search

// the find

sindresorhus/p-queue

★ 4,244 · TypeScript · MIT · updated Jul 2026

Promise queue with concurrency control

p-queue is a TypeScript promise queue with concurrency and rate limiting controls. It's for Node.js code that needs to throttle parallel async work — API calls, file I/O, CPU-bound tasks — without reaching for a full job queue like Bull. The maintainers explicitly say it's feature complete and not under active development.

The rate limiting story is genuinely solid: fixed-window and sliding-window (strict mode) are both supported, and the distinction between them is clearly documented with a concrete example of why fixed windows can burst at boundaries. The observable API is unusually good — onIdle, onEmpty, onPendingZero, onSizeLessThan, onRateLimit, and the corresponding events cover essentially every state transition you'd want to react to. AbortSignal integration for cancellation is done correctly, including the edge case warning that clear() leaves add() promises dangling. The runningTasks property with per-task startTime and timeoutRemaining is a nice debugging affordance that most queue libs skip.

ESM-only is a real tax if you're in a CommonJS codebase — the README acknowledges it and basically says 'your problem to solve.' The custom QueueClass interface is underdocumented: the filter method signature is vague, and there's no explanation of what options it receives or what invariants the implementation must preserve. Error handling has a sharp edge: onError() returns a promise that rejects once, but you still have to .catch() every individual add() call or you'll get unhandled rejections — the two error channels exist simultaneously and both require attention. Feature-complete declaration means bugs and edge cases won't get fixed; the Jest fake timers workaround in the FAQ is a sign that internal use of queueMicrotask creates test friction that won't be addressed.

View on GitHub →

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →