feat: solver exponential backoff - #450
Open
PBillingsby wants to merge 4 commits into
Open
Conversation
bgins
reviewed
Nov 25, 2024
| const ( | ||
| initialDelay = 1.0 | ||
| maxAttempts = 10 | ||
| exponential = 1.2 |
Contributor
There was a problem hiding this comment.
nit: Could we rename this to exponent?
bgins
reviewed
Nov 25, 2024
| errCh <- err | ||
| select { | ||
| case <-ctx.Done(): | ||
| log.Info().Msg("Exiting readMessage loop due to context cancellation.") |
Contributor
There was a problem hiding this comment.
Suggested change
| log.Info().Msg("Exiting readMessage loop due to context cancellation.") | |
| log.Debug().Msg("Exiting readMessage loop due to context cancellation.") |
This detail is a bit internal, would suggest dropping the log level to debug.
bgins
reviewed
Nov 25, 2024
| continue | ||
| switch { | ||
| case websocket.IsCloseError(err, websocket.CloseGoingAway, websocket.CloseAbnormalClosure): | ||
| log.Info().Msg("Solver service closed connection") |
Contributor
There was a problem hiding this comment.
At the moment, we only use this helper function to connect to the solver. But we might re-use it in other contexts, so we may want to reword these errors to something like "Websocket server closed connection".
Contributor
There was a problem hiding this comment.
Also, we may want to log errors we where we will attempt again at the warn level.
bgins
reviewed
Nov 25, 2024
| switch { | ||
| case websocket.IsCloseError(err, websocket.CloseGoingAway, websocket.CloseAbnormalClosure): | ||
| log.Info().Msg("Solver service closed connection") | ||
| return nil, fmt.Errorf("solver connection closed: %w", err) |
Contributor
There was a problem hiding this comment.
Will returning here cause us to give up on our connection attempts?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This pull request makes the following changes:
ConnectWebSocketto return an error alongside the response channelSolverClientTask/Issue reference
Closes: #429
Test plan
pkg/http/websocket_server.goto force an error inHandleFunc:job-creatorterminal for exponential backoff logs