timdp/es6-promise-pool

How to add to pool while it's running?

vedmant opened this issue · 1 comments

How can I add work to a pool while it's already running and make it return only that part of work after that part was finished? I need a pool that's is supposed to run multiple requests in a single pool, requests come from different functions and while pool is still running some old requests. The only requirement is to not to run more that a number of requests simultaneously.

timdp commented

You'd have to make sure the pool stays active and have the producer function deliver a new promise once it becomes available. While it's feasible using this package, you could also consider Bottleneck or one of Sindre's packages.