From e0472050c0216bdb712f4934f7f1c1a232a83c3e Mon Sep 17 00:00:00 2001 From: "Jeff Washington (jwash)" Date: Thu, 18 Aug 2022 11:30:35 -0500 Subject: [PATCH] create helper fn for clarity (#27216) --- runtime/src/in_mem_accounts_index.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/runtime/src/in_mem_accounts_index.rs b/runtime/src/in_mem_accounts_index.rs index 9ab9da4e8099d2..864915399c04cf 100644 --- a/runtime/src/in_mem_accounts_index.rs +++ b/runtime/src/in_mem_accounts_index.rs @@ -279,7 +279,7 @@ impl InMemAccountsIndex { m.stop(); callback(if let Some(entry) = result { - entry.set_age(self.storage.future_age_to_flush()); + self.set_age_to_future(entry); Some(entry) } else { drop(map); @@ -305,6 +305,10 @@ impl InMemAccountsIndex { self.get_internal(pubkey, |entry| (true, entry.map(Arc::clone))) } + fn set_age_to_future(&self, entry: &AccountMapEntry) { + entry.set_age(self.storage.future_age_to_flush()); + } + /// lookup 'pubkey' in index (in_mem or disk). /// call 'callback' whether found or not pub(crate) fn get_internal( @@ -473,7 +477,7 @@ impl InMemAccountsIndex { reclaims, reclaim, ); - current.set_age(self.storage.future_age_to_flush()); + self.set_age_to_future(current); } Entry::Vacant(vacant) => { // not in cache, look on disk