|
|
|
|
|
by winrid
278 days ago
|
|
What's the benefit of promises like this here? Just spin up a loop of 50 call chains. When one completes you just do the next on next tick. It's like 3 lines of code. No libraries needed. Then you're always doing 50 at a time. You can still use await. async work() { await thing(); nextTick(work); } for(to 50) { work(); } then maybe a separate timer to check how many tasks are active I guess. |
|
The implementation is rather simple, but more than 3 LoC: https://github.com/whilenot-dev/promises-batched/blob/main/s...