p-map
p-map copied to clipboard
Allow dynamically changing the concurrency
The idea was brought up in #28.
Not entirely sure what the best API would be for this though. Feedback welcome.
If mapper
returns something like pMap.setConcurrency(5)
then it should set the concurrency
value in memory and then spin up more calls to next()
as needed. Already running next()
chains should check if they are not needed anymore at the start of each iteration:
const next = id => {
if (concurrency < id) {
return
}
// ...
}
pMap.setConcurrency(5)
would need to include the actual value too though.
Yes. It would work in a similar way to pMap.stop
.