Support question - read remaining number of tasks in async.queue
See original GitHub issueI am using async.queue like so:
const q = async.queue((task, cb => task(cb));
How can I find out during debugging how many tasks remain on the queue (and maybe how many have completed?)?
I used util.inspect()
to get the properties on the queue
{ _tasks: DLL { tail: null, head: null, length: 0 },
concurrency: 3,
payload: 1,
saturated: [Function: noop],
unsaturated: [Function: noop],
buffer: 0.75,
empty: [Function: noop],
drain: [Function],
error: [Function: noop],
started: false,
paused: false,
push: [Function: push],
kill: [Function: kill],
unshift: [Function: unshift],
remove: [Function: remove],
process: [Function: process],
length: [Function: length],
running: [Function: running],
workersList: [Function: workersList],
idle: [Function: idle],
pause: [Function: pause],
resume: [Function: resume] }
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
JS async / await tasks queue - javascript
Random enqueue() leads to a big number of "waiting" tasks. Makes sense, since we enqueued all tasks within first ~4000ms , they must...
Read more >How Does the Asynchronous Task Processing System ...
A large number of tasks can be completed faster at a reasonable cost by scaling the resources of the asynchronous task processing system....
Read more >Implementing an Asynchronous Dispatch Queue
Our goal is to make our dispatch queue generic enough that we can change the number of threads for each queue we create....
Read more >Async/Await - Best Practices in Asynchronous Programming
The method is able to complete, which completes its returned task, and there's no deadlock.
Read more >DispatchQueue | Apple Developer Documentation
If too many tasks block, the system may run out of threads for your app. ... concurrent dispatch queues exacerbates the thread consumption...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
q.length()
will return the length of the queue.q._tasks.toArray()
will give you a list of tasks in the queue. There’s no way to tell how many have completed, unless you track that yourself.To remove the drain callback:
No way to use multiple drain callbacks, but you can call multiple functions in the single drain callback.
Still don’t know what the diff is between q.length() and q.running()