Question
How can I check the current number of active tasks?
About sindresorhus/p-limit · 2 messages · last activity 6/8/2026
How can I check the current number of active tasks?
To check the current number of active tasks, you can use the limit.activeCount property.
According to the README, limit.activeCount returns "The number of promises that are currently running."
Here's how you'd use it:
import pLimit from 'p-limit';
const limit = pLimit(2);
// After queueing some tasks...
console.log(limit.activeCount); // Number of promises currently executing
This property is read-only and gives you real-time visibility into how many tasks are actively running at any moment. This is useful for monitoring the concurrency limiter's state during execution.
FOLLOW_UPS:
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.