Skip to content

Instantly share code, notes, and snippets.

View rtuin's full-sized avatar
😃
Hi!

Richard Tuin rtuin

😃
Hi!
View GitHub Profile
@Potherca
Potherca / README.md
Last active June 17, 2020 09:51
List of kick-ass developers to follow based in the Netherlands
@jcouyang
jcouyang / README.org
Last active December 9, 2023 16:46
Promise All with Limit of Concurrent N

The Promise All Problem

in case of processing a very large array e.g. Promise.all(A_VERY_LARGE_ARRAY_OF_XHR_PROMISE)

which would probably blow you browser memory by trying to send all requests at the same time

solution is limit the concurrent of requests, and wrap promise in thunk

Promise.allConcurrent(2)([()=>fetch('BLAH1'), ()=>fetch('BLAH2'),...()=>fetch('BLAHN')])