Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
nokome opened this issue Feb 6, 2020 · 0 comments
Open

Comments

@nokome
Copy link
Member

nokome commented Feb 6, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant