I have am making 400ish requests to a server - and putting each inside promises.
When running all 400 requests in a single promise.all - the system falls over.
I've split my requests into batches of 50 promises (and added them inside a promise.all), and added those all into another promise.all.
How can I run the promises in the batches, and wait for those to be done before moving onto the next?
// attach the other accounts a user has to the wrapper object
// **this is 400+ requests object, that has the requests in it**
// results are promises
const influencerAccounts = wrapper.map(p => addInfluencerAccounts(p));
// split the requests into chunks to stop the server falling over
const chunkedPromises = _.chunk(influencerAccounts, 50);
// promise.all on each chunk of promises/requests
// ????
// ...
return
I've tried looping over the chunked promised arrays (which is an array of promises) and Promise.all(ing) each one - but that's not going to wait from the previous batch to finish before sending the next.
Thanks,
Ollie