mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-08-28 05:27:24 +00:00
Never give up in socket transport (#7616)
This commit is contained in:
parent
641c058587
commit
f8973d9539
1 changed files with 4 additions and 19 deletions
|
|
@ -28,7 +28,7 @@ export class SocketTransport {
|
|||
private hasConnectedOnce: boolean = false
|
||||
|
||||
private readonly retryConfig: RetryConfig = {
|
||||
maxInitialAttempts: 10,
|
||||
maxInitialAttempts: Infinity,
|
||||
initialDelay: 1_000,
|
||||
maxDelay: 15_000,
|
||||
backoffMultiplier: 2,
|
||||
|
|
@ -67,12 +67,8 @@ export class SocketTransport {
|
|||
await this.connectWithRetry()
|
||||
} catch (error) {
|
||||
console.error(
|
||||
`[SocketTransport] Initial connection attempts failed: ${error instanceof Error ? error.message : String(error)}`,
|
||||
`[SocketTransport] Unexpected error in connection loop: ${error instanceof Error ? error.message : String(error)}`,
|
||||
)
|
||||
|
||||
// If we've never connected successfully, we've exhausted our retry attempts
|
||||
// The user will need to manually retry or fix the issue
|
||||
this.connectionState = ConnectionState.FAILED
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -83,9 +79,7 @@ export class SocketTransport {
|
|||
try {
|
||||
this.connectionState = this.retryAttempt === 0 ? ConnectionState.CONNECTING : ConnectionState.RETRYING
|
||||
|
||||
console.log(
|
||||
`[SocketTransport] Connection attempt ${this.retryAttempt + 1} / ${this.retryConfig.maxInitialAttempts}`,
|
||||
)
|
||||
console.log(`[SocketTransport] Connection attempt ${this.retryAttempt + 1}`)
|
||||
|
||||
await this.connectSocket()
|
||||
|
||||
|
|
@ -111,12 +105,6 @@ export class SocketTransport {
|
|||
this.socket = null
|
||||
}
|
||||
|
||||
if (this.retryAttempt >= this.retryConfig.maxInitialAttempts) {
|
||||
this.connectionState = ConnectionState.FAILED
|
||||
|
||||
throw new Error(`Failed to connect after ${this.retryConfig.maxInitialAttempts} attempts`)
|
||||
}
|
||||
|
||||
console.log(`[SocketTransport] Waiting ${delay}ms before retry...`)
|
||||
|
||||
await this.delay(delay)
|
||||
|
|
@ -204,10 +192,7 @@ export class SocketTransport {
|
|||
this.socket.on("reconnect_failed", () => {
|
||||
console.error(`[SocketTransport] Socket.IO reconnection failed after all attempts`)
|
||||
|
||||
this.connectionState = ConnectionState.FAILED
|
||||
|
||||
// Socket.IO has exhausted its reconnection attempts
|
||||
// The connection is now permanently failed until manual intervention
|
||||
this.connectionState = ConnectionState.RETRYING
|
||||
})
|
||||
|
||||
this.socket.on("error", (error) => {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue