diff --git a/accounts-db/src/accounts_db.rs b/accounts-db/src/accounts_db.rs index d062135f996f7f..850b04495d21d8 100644 --- a/accounts-db/src/accounts_db.rs +++ b/accounts-db/src/accounts_db.rs @@ -73,7 +73,7 @@ use { u64_align, utils, verify_accounts_hash_in_background::VerifyAccountsHashInBackground, }, - crossbeam_channel::{unbounded, Receiver, Sender}, + crossbeam_channel::{unbounded, Receiver, Sender, TryRecvError}, dashmap::{DashMap, DashSet}, log::*, rand::{thread_rng, Rng}, @@ -2344,7 +2344,7 @@ impl AccountsDb { fn background_hasher(receiver: Receiver>) { info!("Background account hasher has started"); loop { - let result = receiver.recv(); + let result = receiver.try_recv(); match result { Ok(accounts) => { for account in accounts { @@ -2355,7 +2355,10 @@ impl AccountsDb { }; } } - Err(err) => { + Err(TryRecvError::Empty) => { + sleep(Duration::from_millis(5)); + } + Err(err @ TryRecvError::Disconnected) => { info!("Background account hasher is stopping because: {err}"); break; }