RepoPilot

How can I check the current number of active tasks?

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

Question

How can I check the current number of active tasks?

RepoPilot

You can check the current number of active tasks using the activeCount property on the limit function.

According to [index.d.ts:L3-L5], activeCount is a read-only property that returns "the number of promises that are currently running."

Here's how to use it:

import pLimit from 'p-limit';

const limit = pLimit(5);

// After queuing some tasks...
console.log(limit.activeCount); // Number of promises currently executing

You can also check pendingCount [index.d.ts:L8-L10] to see how many promises are waiting in the queue to run.

FOLLOW_UPS:

  • How do I check pending tasks in the queue?
  • What's the difference between activeCount and pendingCount?
  • Can I dynamically change the concurrency limit?

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.