fix: replace shell sleep with cross-platform Atomics.wait in planning lock (#1693)

Fixes #1692

spawnSync('sleep', ['0.1']) fails silently on Windows (ENOENT),
causing a tight busy-loop during lock contention. Atomics.wait()
provides a cross-platform 100ms blocking wait available in Node 22+.
This commit is contained in:
Jeremy McSpadden
2026-04-04 14:49:59 -05:00
committed by GitHub
parent ade67cf9f9
commit 839ea22d06

View File

@@ -581,8 +581,8 @@ function withPlanningLock(cwd, fn) {
} }
} catch { continue; } } catch { continue; }
// Wait and retry // Wait and retry (cross-platform, no shell dependency)
spawnSync('sleep', ['0.1'], { stdio: 'ignore' }); Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, 100);
continue; continue;
} }
throw err; throw err;