Revert "fix(gateway): terminate owned process before retry to prevent port conflict on Windows" (#755)

This commit is contained in:
Felix
2026-04-02 17:49:16 +08:00
committed by GitHub
Unverified
parent 42d6cec1e0
commit 1d2cbf8f26
3 changed files with 6 additions and 67 deletions

View File

@@ -259,8 +259,8 @@ export class GatewayManager extends EventEmitter {
this.startHealthCheck();
},
waitForPortFree: async (port, signal) => {
await waitForPortFree(port, 30000, signal);
waitForPortFree: async (port) => {
await waitForPortFree(port);
},
startProcess: async () => {
await this.startProcess();
@@ -282,29 +282,6 @@ export class GatewayManager extends EventEmitter {
delay: async (ms) => {
await new Promise((resolve) => setTimeout(resolve, ms));
},
terminateOwnedProcess: async () => {
if (this.process && this.ownsProcess) {
logger.info('Terminating owned Gateway process before retry...');
const proc = this.process;
const pid = proc.pid;
await terminateOwnedGatewayProcess(proc).catch(() => {});
// Only clear the handle if the process has actually exited.
// terminateOwnedGatewayProcess may resolve via its timeout path
// while the child is still alive; in that case keep the reference
// so subsequent retries and stop() can still target it.
if (pid != null) {
try {
process.kill(pid, 0);
// Still alive — keep this.process so later cleanup can reach it
} catch {
// Process is gone — safe to clear the handle
this.process = null;
}
} else {
this.process = null;
}
}
},
});
} catch (error) {
if (error instanceof LifecycleSupersededError) {