fix(scripts): widen fixture-cleanup EPERM retry window

The failover Windows pool releases child-process and antivirus file
handles slower than the hosted pool; a 1-second window (10 x 100 ms)
still exhausts before release under load, so install-lefthook fixture
cleanup threw EPERM in rmSync. A 10-second window (50 x 200 ms) covers
the slower release without pinning afterEach cleanup, since a
terminated child's handles drain once rather than reacquire.
This commit is contained in:
Chinesezjc
2026-08-13 15:16:12 +08:00
parent ed463d74bf
commit b5a130063d
+5 -2
View File
@@ -37,10 +37,13 @@ export function unlinkFixtureLinks(path: string): void {
* Remove one fixture tree after its junctions are unlinked (see
* {@link unlinkFixtureLinks}). Retries the removal: Windows releases child
* process and antivirus file handles asynchronously, and an unretried
* `rmSync` fails immediately with EPERM under load.
* `rmSync` fails immediately with EPERM under load. A 10-second retry window
* (50 attempts × 200 ms) covers the failover pool's slow handle release;
* release is one-shot (a terminated child's handles drain, not reacquired),
* so a bounded window suffices and never pins afterEach cleanup.
* @param path - the fixture tree to remove.
*/
export function removeFixtureSafely(path: string): void {
unlinkFixtureLinks(path)
rmSync(path, { recursive: true, force: true, maxRetries: 10, retryDelay: 100 })
rmSync(path, { recursive: true, force: true, maxRetries: 50, retryDelay: 200 })
}