Skip to content

Commit

Permalink
refactor RecycleStores::add_entries
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffwashington committed Jan 2, 2023
1 parent d5fdb7b commit 5f2b551
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion runtime/src/accounts_db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1199,11 +1199,13 @@ impl RecycleStores {
}

fn add_entries(&mut self, new_entries: SnapshotStorage) {
self.total_bytes += new_entries.iter().map(|e| e.total_bytes()).sum::<u64>();
let mut total_bytes = 0;
let now = Instant::now();
for new_entry in new_entries {
total_bytes += new_entry.total_bytes();
self.entries.push((now, new_entry));
}
self.total_bytes += total_bytes;
}

fn expire_old_entries(&mut self) -> SnapshotStorage {
Expand Down

0 comments on commit 5f2b551

Please sign in to comment.