tests: waitFor budget 8s → 30s — the jobs-suite flake under full-suite load

Under npm test's parallel load the event loop starves and the 8s
wall-clock budget expired before healthy conditions were ever observed;
a timed-out delivery then leaked a late wake into the NEXT test (the
respawn hook is module-global), poisoning even synchronous neighbors —
the recurring double-run-guard / recovery-sweep failures. waitFor
returns the instant the condition holds, so the generous budget costs
nothing when healthy. Full suite 1326/1326.
This commit is contained in:
amosblomqvist
2026-10-05 04:58:00 +03:00
parent 3e402d3c35
commit a2cddb4dca
+7 -1
View File
@@ -184,7 +184,13 @@ function post(chatId: string, input: unknown): Request {
});
}
function waitFor(cond: () => boolean, timeoutMs = 8000, what = "condition"): Promise<void> {
/* 30s budget (owner round, 2026-10-05): under the FULL suite's parallel
* load the event loop starves and an 8s wall-clock budget expired before
* healthy conditions were ever observed — and a timed-out delivery leaked
* a late wake into the NEXT test (the respawn hook is module-global),
* poisoning even synchronous neighbors. waitFor returns the instant the
* condition holds, so the generous budget costs nothing when healthy. */
function waitFor(cond: () => boolean, timeoutMs = 30_000, what = "condition"): Promise<void> {
return new Promise((resolve, reject) => {
const started = Date.now();
const tick = () => {