RepoPilot

Is there a way to inspect the pending queue size?

About sindresorhus/p-limit · 2 messages · last activity 7/27/2026

Question

Is there a way to inspect the pending queue size?

RepoPilot

Yes, you can inspect the pending queue size using the pendingCount property on the limit function.

According to the type definitions in [index.d.ts:L8-L10], 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 documents this in [readme.md:L92-L95]:

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

This is useful for monitoring queue status. The recipes.md file includes an example of using pendingCount for progress reporting [recipes.md:L191-L214], where it logs both activeCount and pendingCount at intervals to track how many tasks are running versus queued.

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

FOLLOW_UPS:

  • What does activeCount measure differently?
  • Can you modify the concurrency limit dynamically?
  • How does clearQueue() interact with pending promises?

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.