Closed danilofuchs closed 2 weeks ago
The issue with Promise.allSettled and Promise.all is that it has no concurrency control. v9 and below had support for this via the p-map package and used the teamConcurrency
option. However this produced too much complexity for all use cases, since some jobs within a batch may take longer than others, reducing the overall throughput over time.
is that it has no concurrency control
What do you mean by concurrency control in the context of Promise.allSettled
? Not sure I understood the requirement
How many promises run in parallel
I'm implementing batch support in my application, and I would like to fail only 1 job of the batch, using
Promise.allSettled
:I could use
fetch
,complete
,fail
myself, but then I loose all theWorker
functionality and have to manage polling myselfWould be nice if
work
had an API for that, for example:work
would only poll again if all jobs have been completed or failed