Skip to content

Commit 12591f3

Browse files
committed
test(cron): make wake-now abort retry regression deterministic
1 parent fb1faf7 commit 12591f3

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/cron/service.issue-regressions.test.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1325,7 +1325,6 @@ describe("Cron issue regressions", () => {
13251325
});
13261326

13271327
it("respects abort signals while retrying main-session wake-now heartbeat runs", async () => {
1328-
vi.useRealTimers();
13291328
const abortController = new AbortController();
13301329
const runHeartbeatOnce = vi.fn(
13311330
async (): Promise<HeartbeatRunResult> => ({
@@ -1364,7 +1363,10 @@ describe("Cron issue regressions", () => {
13641363
abortController.abort();
13651364
}, 10);
13661365

1367-
const result = await executeJobCore(state, mainJob, abortController.signal);
1366+
const resultPromise = executeJobCore(state, mainJob, abortController.signal);
1367+
// Advance virtual time so the abort fires before the busy-wait fallback window expires.
1368+
await vi.advanceTimersByTimeAsync(10);
1369+
const result = await resultPromise;
13681370

13691371
expect(result.status).toBe("error");
13701372
expect(result.error).toContain("timed out");

0 commit comments

Comments
 (0)