Dynamic Async Queuing
Most of the time, the simple methods from the last two sections are enough to solve your async dilemmas. But async.series and async.parallel have their limitations.
-
The task array is static. Once youâve called async.series or async.parallel, you canât add or remove tasks.
-
Thereâs also no way to ask, âHow many tasks have been completed?â Itâs a black box, unless you dispatch updates from the tasks themselves.
-
Youâre limited to either no concurrency or unlimited concurrency. Thatâs a pretty big deal when it comes to file I/O. If weâre operating on thousands of files, we donât want to be inefficient by doing a series, but weâre likely to anger the OS if we try to do everything in parallel.
Async.js ...
Get Async JavaScript now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.