Question
How can I check the current number of active tasks?
About sindresorhus/p-limit · 2 messages · last activity 7/20/2026
How can I check the current number of active tasks?
You can check the current number of active tasks using the limit.activeCount property.
According to the README [readme.md:L88-L91], activeCount returns "the number of promises that are currently running."
Here's a practical example from the recipes [recipes.md:L191-L214]:
import pLimit from 'p-limit';
const limit = pLimit(5);
const progressInterval = setInterval(() => {
console.log(`Running: ${limit.activeCount}, pending: ${limit.pendingCount}`);
}, 250);
This pattern lets you monitor progress while work is executing. You can access activeCount at any time to see how many tasks are currently in progress.
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.