use promise

This commit is contained in:
Simon Knott 2024-11-29 12:50:36 +01:00
parent 27215559ab
commit 2a47f29b29
No known key found for this signature in database
GPG key ID: 8CEDC00028084AEC

View file

@ -1278,7 +1278,7 @@ async function allThrottled<T>(items: T[], fn: (item: T) => Promise<void>, concu
const event = new EventEmitter(); const event = new EventEmitter();
await Promise.all(items.map(async item => { await Promise.all(items.map(async item => {
while (state.budget < 1) while (state.budget < 1)
await new Promise(f => event.once('done', f)); await EventEmitter.once(event, 'done');
try { try {
state.budget--; state.budget--;