Re:Understanding Node.js Event-Driven Architecture
by elithrar on Sunday May 14, 2017 @04:20PM
(#14337373)
Have you looked at http://bluebirdjs.com/docs/api/promise.map.html - which allows you to control the concurrency of Promises easily?
I wish that promises had a concept similar to this. It's simply too annoying for me to manually refactor a bunch of Promise.all() calls to manually adjust the concurrency of the logic flow compared to using the dependency pattern of async.auto().
And based on what I've seen this is a common problem in both async functions, generators, and promises. Since it is difficult to properly execute a tree of functional steps with the maximal concurrency I see code all the time which just runs async functions or promises in a series instead of taking advantage of the ability to concurrently execute two branches of the tree at the same time.