diff --git a/runtime/src/accounts_index_storage.rs b/runtime/src/accounts_index_storage.rs index eb53c01be7..bc03d2f57e 100644 --- a/runtime/src/accounts_index_storage.rs +++ b/runtime/src/accounts_index_storage.rs @@ -1,5 +1,5 @@ use crate::accounts_index::{AccountsIndexConfig, IndexValue}; -use crate::bucket_map_holder::BucketMapHolder; +use crate::bucket_map_holder::{BucketMapHolder, AGE_MS}; use crate::in_mem_accounts_index::InMemAccountsIndex; use std::fmt::Debug; use std::time::Duration; @@ -99,14 +99,15 @@ impl AccountsIndexStorage { let bins = in_mem.len(); let flush = storage.disk.is_some(); loop { - // this will transition to waits and thread throttling + // this will transition to thread throttling storage .wait_dirty_or_aged - .wait_timeout(Duration::from_millis(10000)); + .wait_timeout(Duration::from_millis(AGE_MS)); if exit.load(Ordering::Relaxed) { break; } + storage.maybe_advance_age(); storage.stats.active_threads.fetch_add(1, Ordering::Relaxed); for _ in 0..bins { if flush { diff --git a/runtime/src/bucket_map_holder.rs b/runtime/src/bucket_map_holder.rs index 7dc02b4406..315a122305 100644 --- a/runtime/src/bucket_map_holder.rs +++ b/runtime/src/bucket_map_holder.rs @@ -10,7 +10,7 @@ use std::sync::atomic::{AtomicBool, AtomicU8, AtomicUsize, Ordering}; use std::sync::Mutex; pub type Age = u8; -const AGE_MS: u64 = SLOT_MS; // match one age per slot time +pub const AGE_MS: u64 = SLOT_MS; // match one age per slot time pub struct BucketMapHolder { pub disk: Option>>,