Question
How can I check the current number of active tasks?
About sindresorhus/p-limit · 2 messages · last activity 7/27/2026
How can I check the current number of active tasks?
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:
Want to ask your own question?
Open chat for sindresorhus/p-limitPublic 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.