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

stop sending sync status after first/main sync status is finished #2022

Closed
borngraced opened this issue Dec 7, 2023 · 1 comment · Fixed by #2089
Closed

stop sending sync status after first/main sync status is finished #2022

borngraced opened this issue Dec 7, 2023 · 1 comment · Fixed by #2089
Assignees

Comments

@borngraced
Copy link
Member

loop {
match wallet_ops_guard_clone.block_height_extrema().await? {
Some((_, max_in_wallet)) => {
if max_in_wallet >= current_block {
break;
} else {
self.notify_building_wallet_db(max_in_wallet.into(), current_block.into());
}
},
None => self.notify_building_wallet_db(0, current_block.into()),
}

SaplingSyncLoopHandle keeps sending sync status after main sync process is finished which results to error like

7 10:57:53, common::log:305] DEBUG z_rpc:679] No one seems interested in SyncStatus: send failed because channel is full

We need to figure out a method to stop sending updates after the main/first synchronization process. One way to achieve this is by introducing a new field called main_sync_state_finished to the SaplingSyncLoopHandle. This field would act as a marker to signal when the main synchronization is completed. Before sending any new updates, we can check the value of main_sync_state_finished to ensure that the main synchronization has indeed finished.

same issue goes for

pub struct UtxoSyncStatusLoopHandle(AsyncSender<UtxoSyncStatus>);
impl UtxoSyncStatusLoopHandle {
pub fn new(sync_status_notifier: AsyncSender<UtxoSyncStatus>) -> Self {
UtxoSyncStatusLoopHandle(sync_status_notifier)
}
pub fn notify_blocks_headers_sync_status(&mut self, current_scanned_block: u64, last_block: u64) {
self.0
.try_send(UtxoSyncStatus::SyncingBlockHeaders {
current_scanned_block,
last_block,
})
.debug_log_with_msg("No one seems interested in UtxoSyncStatus");
}
pub fn notify_on_temp_error(&mut self, error: impl ToString) {
self.0
.try_send(UtxoSyncStatus::TemporaryError(error.to_string()))
.debug_log_with_msg("No one seems interested in UtxoSyncStatus");
}
pub fn notify_on_permanent_error(&mut self, error: impl ToString) {
self.0
.try_send(UtxoSyncStatus::PermanentError(error.to_string()))
.debug_log_with_msg("No one seems interested in UtxoSyncStatus");
}
pub fn notify_sync_finished(&mut self, block_number: u64) {
self.0
.try_send(UtxoSyncStatus::Finished { block_number })
.debug_log_with_msg("No one seems interested in UtxoSyncStatus");
}
}

cc @shamardy

@borngraced borngraced changed the title stop sending sync status after first/main sync finished status stop sending sync status after first/main sync status is finished Dec 7, 2023
@borngraced borngraced self-assigned this Dec 13, 2023
@borngraced borngraced linked a pull request Mar 19, 2024 that will close this issue
3 tasks
@shamardy
Copy link
Collaborator

Fixed here #2089

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

Successfully merging a pull request may close this issue.

2 participants