Skip to content

Commit 5580ad5

Browse files
committed
Fix busy-wait polling in CheckpointReactor tests
Replace Effect.yieldNow (near-instant microtask resolution) with Effect.sleep("10 millis") to restore a real delay between poll iterations in waitForThread, waitForEvent, and waitForGitRefExists. Without a real delay, these polling loops spin as tight busy-waits, starving the event loop of time to process I/O callbacks from git operations and database writes.
1 parent 329a458 commit 5580ad5

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

apps/server/src/orchestration/Layers/CheckpointReactor.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ async function waitForThread(
170170
if ((await Effect.runPromise(Clock.currentTimeMillis)) >= deadline) {
171171
throw new Error("Timed out waiting for thread state.");
172172
}
173-
await Effect.runPromise(Effect.yieldNow);
173+
await Effect.runPromise(Effect.sleep("10 millis"));
174174
return poll();
175175
};
176176
return poll();
@@ -192,7 +192,7 @@ async function waitForEvent(
192192
if ((await Effect.runPromise(Clock.currentTimeMillis)) >= deadline) {
193193
throw new Error("Timed out waiting for orchestration event.");
194194
}
195-
await Effect.runPromise(Effect.yieldNow);
195+
await Effect.runPromise(Effect.sleep("10 millis"));
196196
return poll();
197197
};
198198
return poll();
@@ -239,7 +239,7 @@ async function waitForGitRefExists(cwd: string, ref: string, timeoutMs = 15_000)
239239
if ((await Effect.runPromise(Clock.currentTimeMillis)) >= deadline) {
240240
throw new Error(`Timed out waiting for git ref '${ref}'.`);
241241
}
242-
await Effect.runPromise(Effect.yieldNow);
242+
await Effect.runPromise(Effect.sleep("10 millis"));
243243
return poll();
244244
};
245245
return poll();

0 commit comments

Comments
 (0)