Open lart2150 opened 2 years ago
if (queue.length > CONCURRENCY_LIMIT) { await queue.shift() }
queue.shift() does not return a promise so this does not wait.
you could do something like
while (queue.length > CONCURRENCY_LIMIT) { await sleep(Math.random(100)) }
and then in the finally add queue.pop();
This would be a non deterministic queue but it's a simple change to support CONCURRENCY_LIMIT
queue.shift() does not return a promise so this does not wait.
you could do something like
and then in the finally add queue.pop();
This would be a non deterministic queue but it's a simple change to support CONCURRENCY_LIMIT