Skip to content

Commit 2bf189d

Browse files
author
jun
committed
test(native-main-refresh): yield to the event loop while waiting for the abort listener
The wait spun on Promise.resolve(), which keeps the microtask queue non-empty and never lets a subprocess exit callback run. On Windows the exclusive claim can harden its lock file through an async icacls child before it reaches the abort listener, so the spin never ends. Dispatch 33597649234 shard 4 sat in this file for eight minutes until the job ceiling with zero failures logged.
1 parent 1e76a7d commit 2bf189d

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

‎tests/responses-native-main-refresh.test.ts‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,11 @@ describe("native main 401 refresh and replay", () => {
164164
const timeoutSpy = spyOn(AbortSignal, "timeout").mockReturnValue(timeout.signal);
165165
try {
166166
const pending = getValidMainAccountToken();
167-
while (!addListener.mock.calls.some(([type]) => type === "abort")) await Promise.resolve();
167+
// Yield to the macrotask queue, not only microtasks: on Windows the exclusive claim
168+
// hardens its lock file through an icacls/PowerShell subprocess before it ever reaches
169+
// the abort listener, and a microtask spin never lets that child's exit callback run.
170+
// Dispatch 33597649234 shard 4 sat here for 8 minutes until the job ceiling.
171+
while (!addListener.mock.calls.some(([type]) => type === "abort")) await Bun.sleep(1);
168172
timeout.abort(new DOMException("claim timed out", "TimeoutError"));
169173
await expect(pending).rejects.toMatchObject({
170174
name: "MainAccountTokenRefreshError",

0 commit comments

Comments
 (0)