Skip to content

Commit

Permalink
early exit
Browse files Browse the repository at this point in the history
  • Loading branch information
fanatid committed Dec 16, 2024
1 parent 526eef9 commit 251612b
Showing 1 changed file with 17 additions and 15 deletions.
32 changes: 17 additions & 15 deletions accounts-db/src/accounts_db/geyser_plugin_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,24 @@ impl AccountsDb {
/// in the reverse order of the slots so that an account is only streamed once. At a slot, if the accounts is updated
/// multiple times only the last write (with highest write_version) is notified.
pub fn notify_account_restore_from_snapshot(&self) {
if let Some(accounts_update_notifier) = &self.accounts_update_notifier {
if accounts_update_notifier.notify_snapshot_disabled() {
accounts_update_notifier.notify_end_of_restore_from_snapshot();
} else {
let mut slots = self.storage.all_slots();
let mut notified_accounts: HashSet<Pubkey> = HashSet::default();
let mut notify_stats = GeyserPluginNotifyAtSnapshotRestoreStats::default();

slots.sort_by(|a, b| b.cmp(a));
for slot in slots {
self.notify_accounts_in_slot(slot, &mut notified_accounts, &mut notify_stats);
}

accounts_update_notifier.notify_end_of_restore_from_snapshot();
notify_stats.report();
let Some(accounts_update_notifier) = &self.accounts_update_notifier else {
return;
};

if accounts_update_notifier.notify_snapshot_disabled() {
accounts_update_notifier.notify_end_of_restore_from_snapshot();
} else {
let mut slots = self.storage.all_slots();
let mut notified_accounts: HashSet<Pubkey> = HashSet::default();
let mut notify_stats = GeyserPluginNotifyAtSnapshotRestoreStats::default();

slots.sort_by(|a, b| b.cmp(a));
for slot in slots {
self.notify_accounts_in_slot(slot, &mut notified_accounts, &mut notify_stats);
}

accounts_update_notifier.notify_end_of_restore_from_snapshot();
notify_stats.report();
}
}

Expand Down

0 comments on commit 251612b

Please sign in to comment.