test(perf): clear concurrent-start timeout handle in cron regression test

This commit is contained in:
Peter Steinberger 2026-03-02 12:07:38 +00:00
parent 8e0ca219a4
commit f01862bce2
1 changed files with 8 additions and 6 deletions

View File

@ -1491,12 +1491,14 @@ describe("Cron issue regressions", () => {
});
const timerPromise = onTimer(state);
await Promise.race([
bothRunsStarted.promise,
new Promise<never>((_, reject) =>
setTimeout(() => reject(new Error("timed out waiting for concurrent job starts")), 1_000),
),
]);
const startTimeout = setTimeout(() => {
bothRunsStarted.reject(new Error("timed out waiting for concurrent job starts"));
}, 250);
try {
await bothRunsStarted.promise;
} finally {
clearTimeout(startTimeout);
}
expect(peakActiveRuns).toBe(2);