Is there a way/pattern to implement let res = Promise.all([...p], limit)
?
- The promise-array holds functions which construct and return the promise
res
should be resolved after allp
resolves- Only
limit=3
Promises should run in parallel - The n+1th Promise should start immediately after n finishes. So that there are always
limit
resolvers running in parallel.
Especially the last point creates my headaches.
My current solution is to split the promises-array into chunks of limit
size and chain them. The disadvantages here is that the second bunch don't start until all Promises from bunch 1 has been resolved.