From 15a3faa9962e9658b6c56c2d1a0dae938bb886ad Mon Sep 17 00:00:00 2001 From: paisley <8197966+su8su@users.noreply.github.com> Date: Fri, 27 Mar 2026 19:07:31 +0800 Subject: [PATCH] fix(gateway): skip heartbeat ping on Windows to prevent reconnect cascade (#694) --- electron/gateway/manager.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/electron/gateway/manager.ts b/electron/gateway/manager.ts index 13f9a3d75..3b161f6d0 100644 --- a/electron/gateway/manager.ts +++ b/electron/gateway/manager.ts @@ -769,7 +769,14 @@ export class GatewayManager extends EventEmitter { port, 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) => { this.handleMessage(message);