I don’t know if this is of any help, but here might be an alternative way to solving your problem.
The gist is to process the requests in batches and as soon as one gets resolved, you go and resolve another promise that hasn’t been included yet, and so forth.
Thanks for sharing your solution as well. I believe that what you did (take3subtake1part1) can be achieved by Bluebird's Promise.map with the concurrency option. From the docs:
"The concurrency limit applies to Promises returned by the mapper function and it basically limits the number of Promises created. For example, if concurrency is 3 and the mapper callback has been called enough so that there are three returned Promises currently pending, no further callbacks are called until one of the pending Promises resolves. So the mapper function will be called three times and it will be called again only after at least one of the Promises resolves."
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Really interesting problem! Thanks for sharing!
I don’t know if this is of any help, but here might be an alternative way to solving your problem.
The gist is to process the requests in batches and as soon as one gets resolved, you go and resolve another promise that hasn’t been included yet, and so forth.
Best of luck! 🍻
Thanks for sharing your solution as well. I believe that what you did (
take3subtake1part1
) can be achieved by Bluebird'sPromise.map
with the concurrency option. From the docs:"The concurrency limit applies to Promises returned by the mapper function and it basically limits the number of Promises created. For example, if concurrency is 3 and the mapper callback has been called enough so that there are three returned Promises currently pending, no further callbacks are called until one of the pending Promises resolves. So the mapper function will be called three times and it will be called again only after at least one of the Promises resolves."