fix: 修复重连逻辑,确保在重连失败时保留尝试次数以继续重试链

This commit is contained in:
cmliu committed 2026-08-05 02:29:39 +08:00
1 parent dece143ef8
commit cefa4cf35c
1 file changed
+6
+6
View File
@@ -872,7 +872,13 @@ export class ProcessManager {
console.log(
`[WS-Reconnect] ${new Date().toISOString()} | Process | reconnect_failed | attempt=${attempts}/${RECONNECT_MAX_ATTEMPTS}`,
);
// attach() zeroed the counter; restore so the retry chain continues
// where it left off instead of restarting from attempt 1.
if (this.wantConnection) {
this.reconnectAttempts = attempts;
}
this.scheduleReconnect();
return;
}
// Successful attach() zeros reconnectAttempts; restore so the open
// handler can log reconnect_success and the back-off chain continues