@@ -1359,24 +1359,26 @@ if (path) fs.appendFileSync(path, JSON.stringify({ pid: process.pid, role: proce
13591359 // Detached launchers admitted during the killed-supervisor window can finish
13601360 // after the tracked replacement exits. Drain only supervisors authenticated
13611361 // on this test-owned socket, and require two clients to agree on identity.
1362+ const lateSupervisorHandshakeTimeoutMs = 5000 ;
1363+ const unavailableProofMs = 5000 ;
13621364 let unavailableSince = Date . now ( ) ;
1363- const drainDeadline = Date . now ( ) + 5000 ;
1365+ const drainDeadline = Date . now ( ) + 20_000 ;
13641366 while ( Date . now ( ) < drainDeadline ) {
13651367 const first = new DaemonClient ( socketPath ) ;
13661368 try {
13671369 await first . connect ( 100 ) ;
13681370 } catch {
13691371 first . close ( ) ;
1370- if ( Date . now ( ) - unavailableSince >= 1000 ) break ;
1372+ if ( Date . now ( ) - unavailableSince >= unavailableProofMs ) break ;
13711373 await new Promise ( ( resolveDelay ) => setTimeout ( resolveDelay , 50 ) ) ;
13721374 continue ;
13731375 }
13741376 unavailableSince = Date . now ( ) ;
13751377 const second = new DaemonClient ( socketPath ) ;
13761378 try {
1377- await second . connect ( 1000 ) ;
1378- const firstHello = await first . waitForHello ( 1000 ) ;
1379- const secondHello = await second . waitForHello ( 1000 ) ;
1379+ await second . connect ( lateSupervisorHandshakeTimeoutMs ) ;
1380+ const firstHello = await first . waitForHello ( lateSupervisorHandshakeTimeoutMs ) ;
1381+ const secondHello = await second . waitForHello ( lateSupervisorHandshakeTimeoutMs ) ;
13801382 if (
13811383 ! firstHello . supervisorPid ||
13821384 ! firstHello . supervisorProcessStartId ||
@@ -1396,7 +1398,7 @@ if (path) fs.appendFileSync(path, JSON.stringify({ pid: process.pid, role: proce
13961398 second . close ( ) ;
13971399 }
13981400 }
1399- if ( Date . now ( ) - unavailableSince < 1000 ) {
1401+ if ( Date . now ( ) - unavailableSince < unavailableProofMs ) {
14001402 throw new Error ( "Test-owned supervisor socket did not remain unavailable" ) ;
14011403 }
14021404 } ,
0 commit comments