const queue = new PQueue({ concurrency: 5 });
queue.addAll(myTaskQueue);
queue.on('active', () => {
console.log(`${queue.size} requests remain to be scraped, pending workers: ${queue.pending}`);
});
console log
5 requests remain to be scraped, pending workers: 4
4 requests remain to be scraped, pending workers: 4
3 requests remain to be scraped, pending workers: 4
2 requests remain to be scraped, pending workers: 4
1 requests remain to be scraped, pending workers: 4
active event
console log