-
Notifications
You must be signed in to change notification settings - Fork 110
Implement Exponential Backoff for Transient Sync Errors #588
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
base: main
Are you sure you want to change the base?
Conversation
…ith retry delay multiplier
👋 Thanks for assigning @tnull as a reviewer! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
CI is unhappy though, please check that the code compiles before pushing.
@@ -504,8 +506,23 @@ impl ChainSource { | |||
|
|||
Err(e) => { | |||
log_error!(logger, "Failed to synchronize chain listeners: {:?}", e); | |||
tokio::time::sleep(Duration::from_secs(CHAIN_POLLING_INTERVAL_SECS)) | |||
.await; | |||
backoff_delay_multiplier += 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we should let the backoff delay grow infinitely. Please include a sane upper bound.
} else { | ||
log_error!( | ||
logger, | ||
"Failed to synchronize chain listeners: {:?}, e" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This doesn't compile. Also, as discussed elsewhere, we at least need to error out. But technically, we should keep retrying currently as otherwise we'd need to add panic here as permanently being unable to connect to the chain source is an unrecoverable error.
Yeah, just saw that, would check it out now.. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please also make sure to always provide rationale for the change in the commit message, and format it properly (heading shouldn't be larger than one line). Feel free to refer to https://cbea.ms/git-commit/ on how to write good commit messages.
This PR attempts to improve retry in the bitcoind RPC synchronization loop from #587 by replacing the existing linear backoff with a proper exponential backoff strategy. We could also add a maximum delay to prevent excessively long waits, but I am not sure if it would really help.