From 5f2b551d74b96ef1d23d717d5b4a902a6ca28076 Mon Sep 17 00:00:00 2001 From: jeff washington Date: Mon, 2 Jan 2023 16:59:02 -0600 Subject: [PATCH] refactor RecycleStores::add_entries --- runtime/src/accounts_db.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/runtime/src/accounts_db.rs b/runtime/src/accounts_db.rs index 02f28e571e1a85..491435dfd2ffcb 100644 --- a/runtime/src/accounts_db.rs +++ b/runtime/src/accounts_db.rs @@ -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::(); + 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 {