feat(client): make the reconnect attempt limit configurable - #763
Merged
Conversation
Prior to this change, Connection::reconnect would give up after a hard-coded MAX_RECONNECT_ATTEMPTS (20 attempts, ~443 s with the capped fibonacci backoff) and then shuts the message bus down permanently. As a result, TWS/IB Gateway outages longer than ~7 minutes would kill a client apps connection, with no way to opt into a longer retry. That could be quite annoying if the client app should span the TWS/IB Gateways daily restarts and the user didn't manage to log back in in time. This commit adds ClientBuilder::max_reconnect_attempts and ClientBuilder::reconnect_forever (async and sync) to give client apps more control. The default behaviour is unchanged.
- reconnect_forever() stores None; the 20-attempt default moves into BuilderState::default() instead of a validate()-time unwrap_or - Option<u32> threaded through ValidatedPieces and both connections; reconnect loops use is_none_or and log without a denominator when unlimited - rename sync Connection.max_retries -> max_reconnect_attempts (async parity) - builder docs state the default inline + examples; tests for default/override/forever - CHANGELOG entry; README + architecture.md note the limit is configurable
Owner
|
Pushed a follow-up commit on your branch: unlimited is now represented as |
…econnect limit
Contributor
Author
|
That's awesome, thank you for taking the time to detail your changes! |
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.
Prior to this change, Connection::reconnect would give up after a hard-coded MAX_RECONNECT_ATTEMPTS (20 attempts, ~443 s with the capped fibonacci backoff) and then shuts the message bus down permanently. As a result, TWS/IB Gateway outages longer than ~7 minutes would kill a client apps connection, with no way to opt into a longer retry. That could be quite annoying if the client app should span the TWS/IB Gateways daily restarts and the user didn't manage to log back in in time.
This commit adds ClientBuilder::max_reconnect_attempts and ClientBuilder::reconnect_forever (async and sync) to give client apps more control. The default behaviour is unchanged.
Fixes #762