-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
The WebSocketClient contains logic to attempt re-connection if the connection is closed. This includes the use of retry from the p-retry package - which is supposed to have exponential backoff. However, I've noticed during testing that sometimes, when the remote executor is ended, that CPU usage goes up, probably due to something here:
executa/src/ws/WebSocketClient.ts
Lines 101 to 117 in 6b17920
| socket.onclose = (event: CloseEvent) => { | |
| // Try to reconnect if not explicitly closed or if | |
| // authentication failed | |
| if (this.stopped === true) return | |
| const { code, reason } = event | |
| if (code === 4001) { | |
| if (logging) log.error(`Failed to authenticate with server: ${reason}`) | |
| return | |
| } | |
| if (retries > 0) { | |
| if (logging) log.info(`Connection closed, trying to reconnect`) | |
| retry(() => this.start(), { | |
| retries, | |
| randomize: true | |
| }).catch(error => log.error(error)) | |
| } | |
| } |
alex-ketch
Metadata
Metadata
Assignees
Labels
No labels