Execute batch of promises in series. Once Promise.all is done go to the next batch
An answer from October 2020. Async/await makes it short: only 10 code lines+JSDoc. /** * Same as Promise.all(items.map(item => task(item))), but it waits for * the first {batchSize} promises to finish before starting the next batch. * * @template A * @template B * @param {function(A): B} task The task to run for each item. … Read more