RepoPilot

Is there a way to inspect the pending queue size?

About sindresorhus/p-limit · 2 messages · last activity 6/29/2026

Question

Is there a way to inspect the pending queue size?

RepoPilot

Yes, there is. You can inspect the pending queue size using the pendingCount property on the limit function.

According to the TypeScript definitions [index.d.ts:L6-L9], pendingCount is a read-only property that represents:

The number of promises that are waiting to run (i.e. their internal fn was not called yet).

The README also documents this in [readme.md:L92-L95]:

limit.pendingCount

The number of promises that are waiting to run (i.e. their internal fn was not called yet).

A practical example is shown in the recipes for progress reporting [recipes.md:L191-L214], where pendingCount is used alongside activeCount to display real-time progress:

console.log(`Running: ${limit.activeCount}, pending: ${limit.pendingCount}`);

There's also a test demonstrating this in [test.js:L180-L219], where pendingCount is checked after queueing work and after clearing the queue.

FOLLOW_UPS:

  • How do you clear the pending queue?
  • What's the difference between activeCount and pendingCount?
  • Can you change the concurrency limit dynamically?

Want to ask your own question?

Open chat for sindresorhus/p-limit

Public Q&A. Generated by RepoPilot from the actual source of sindresorhus/p-limit. AI answers can be incomplete or stale — verify before relying on them.