fix(gateway): skip heartbeat ping on Windows to prevent reconnect cascade (#694)

This commit is contained in:
paisley
2026-03-27 19:07:31 +08:00
committed by GitHub
Unverified
parent 77d6879b16
commit 15a3faa996

View File

@@ -769,7 +769,14 @@ export class GatewayManager extends EventEmitter {
port, port,
connectedAt: Date.now(), connectedAt: Date.now(),
}); });
this.startPing(); // On Windows, skip WebSocket heartbeat ping to avoid cascading failures:
// heartbeat timeout → terminate socket → reconnect → port conflict
// (old process holds port due to TCP TIME_WAIT) → ~2 min downtime.
// Gateway is a local child process; actual crashes are caught by the
// process exit handler, and graceful restarts use code=1012 close frames.
if (process.platform !== 'win32') {
this.startPing();
}
}, },
onMessage: (message) => { onMessage: (message) => {
this.handleMessage(message); this.handleMessage(message);