-
Notifications
You must be signed in to change notification settings - Fork 122
Make sync timeouts configurable #774
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
Make sync timeouts configurable #774
Conversation
|
👋 Thanks for assigning @jkczyz as a reviewer! |
Previously, the timeouts applied to chain syncing weren't configurable to users. While historically there were good reasons for this (mostly to avoid leaving the Node in a blocked state for extended periods during chain syncing), by now we should be good to let the users configure timeouts ~freely, if they deem it fit. Here we allow for exactly that. Signed-off-by: Elias Rohrer <dev@tnull.de>
It seems that users often hit these timeouts when running in production, especially when run in sub-optimal network condidtions. Here we considerably bump the timeouts, in the hopes that users now normally shouldn't hit them ever. Signed-off-by: Elias Rohrer <dev@tnull.de>
13ae399 to
40c4b09
Compare
|
|
||
| // The default timeout after which we abort a wallet syncing operation. | ||
| const DEFAULT_BDK_WALLET_SYNC_TIMEOUT_SECS: u64 = 20; | ||
| const DEFAULT_BDK_WALLET_SYNC_TIMEOUT_SECS: u64 = 60; |
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.
If there is an outstanding sync, do we skip a newly requested one?
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.
Actually no, additional sync calls would subscribe and wait for the the pending sync to finish. The result will then be propagated via propagate_result_to_subscribers:
Lines 56 to 83 in 5d83000
| fn propagate_result_to_subscribers(&mut self, res: Result<(), Error>) { | |
| // Send the notification to any other tasks that might be waiting on it by now. | |
| { | |
| match self { | |
| WalletSyncStatus::Completed => { | |
| // No sync in-progress, do nothing. | |
| return; | |
| }, | |
| WalletSyncStatus::InProgress { subscribers } => { | |
| // A sync is in-progress, we notify subscribers. | |
| if subscribers.receiver_count() > 0 { | |
| match subscribers.send(res) { | |
| Ok(_) => (), | |
| Err(e) => { | |
| debug_assert!( | |
| false, | |
| "Failed to send wallet sync result to subscribers: {:?}", | |
| e | |
| ); | |
| }, | |
| } | |
| } | |
| *self = WalletSyncStatus::Completed; | |
| }, | |
| } | |
| } | |
| } | |
| } |
In case of a timeout that would be an Error::TxSyncTimeout.
Previously, the timeouts applied to chain syncing weren't configurable
to users. While historically there were good reasons for this (mostly to
avoid leaving the Node in a blocked state for extended periods during
chain syncing), by now we should be good to let the users configure
timeouts ~freely, if they deem it fit. Here we allow for exactly that.
We also bump the previous defaults considerably, in the hopes that users now normally
shouldn't hit them ever.