Skip to content

WebSocketClient: High browser CPU usage when remote executor exits #84

@nokome

Description

@nokome

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:

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))
}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions