judge: bug fixes

This commit is contained in:
undefined committed 2025-09-28 16:13:11 +08:00
1 parent 753f7613e7
commit 40b933e436
3 files changed
+18 -12

No files matched your search

+5 -8
View File
@@ -54,16 +54,13 @@ export class Consumer {
});
continue;
}
// eslint-disable-next-line no-await-in-loop
const res = await getFirst(this.filter);
const res = await getFirst(this.filter); // eslint-disable-line no-await-in-loop
if (!res) {
let timeout: NodeJS.Timeout = null;
// eslint-disable-next-line no-await-in-loop
await new Promise((resolve) => {
timeout = setTimeout(resolve, 1000 / (this.concurrency - this.processing.size));
this.notify = resolve;
});
clearTimeout(timeout);
await Promise.race([
new Promise((resolve) => { this.notify = resolve; }),
sleep(1000 / (this.concurrency - this.processing.size)),
]);
continue;
}
this.processing.add(res);