Skip to content
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.

Commit

Permalink
Minimize ops done with read lock held
Browse files Browse the repository at this point in the history
  • Loading branch information
Steven Czabaniuk committed Sep 1, 2023
1 parent 0d97ac9 commit 1b614aa
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions core/src/shred_fetch_stage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,12 @@ impl ShredFetchStage {
if last_updated.elapsed().as_millis() as u64 > DEFAULT_MS_PER_SLOT {
last_updated = Instant::now();
{
let bank_forks_r = bank_forks.read().unwrap();
let root_bank = bank_forks_r.root_bank();
let root_bank = {
let bank_forks_r = bank_forks.read().unwrap();
last_slot = bank_forks_r.highest_slot();
bank_forks_r.root_bank()
};
last_root = root_bank.slot();
last_slot = bank_forks_r.highest_slot();
slots_per_epoch = root_bank.get_slots_in_epoch(root_bank.epoch());
}
keypair = repair_context
Expand Down

0 comments on commit 1b614aa

Please sign in to comment.