mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-02 21:01:51 +00:00
fix(tlon): add infinite reconnect with reset after max attempts
Instead of giving up after maxReconnectAttempts, wait 10 seconds then reset the counter and keep trying. This ensures the monitor never permanently disconnects due to temporary network issues.
This commit is contained in:
committed by
Josh Lehman
parent
94501d3310
commit
62fa5a96e2
@@ -391,11 +391,16 @@ export class UrbitSSEClient {
|
||||
return;
|
||||
}
|
||||
|
||||
// If we've hit max attempts, wait longer then reset and keep trying
|
||||
if (this.reconnectAttempts >= this.maxReconnectAttempts) {
|
||||
this.logger.error?.(
|
||||
`[SSE] Max reconnection attempts (${this.maxReconnectAttempts}) reached. Giving up.`,
|
||||
this.logger.log?.(
|
||||
`[SSE] Max reconnection attempts (${this.maxReconnectAttempts}) reached. Waiting 10s before resetting...`,
|
||||
);
|
||||
return;
|
||||
// Wait 10 seconds before resetting and trying again
|
||||
const extendedBackoff = 10000; // 10 seconds
|
||||
await new Promise((resolve) => setTimeout(resolve, extendedBackoff));
|
||||
this.reconnectAttempts = 0; // Reset counter to continue trying
|
||||
this.logger.log?.("[SSE] Reconnection attempts reset, resuming reconnection...");
|
||||
}
|
||||
|
||||
this.reconnectAttempts += 1;
|
||||
|
||||
Reference in New Issue
Block a user