Unifies logging of start/stop for background services (#30916)

This commit is contained in:
Brooks 2023-03-28 08:32:18 -04:00 committed by GitHub
parent 2cefbd1dfd
commit d7ae05c3fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 5 deletions

View File

@ -61,6 +61,7 @@ impl AccountsHashVerifier {
let t_accounts_hash_verifier = Builder::new() let t_accounts_hash_verifier = Builder::new()
.name("solAcctHashVer".to_string()) .name("solAcctHashVer".to_string())
.spawn(move || { .spawn(move || {
info!("AccountsHashVerifier has started");
let mut hashes = vec![]; let mut hashes = vec![];
loop { loop {
if exit.load(Ordering::Relaxed) { if exit.load(Ordering::Relaxed) {
@ -109,7 +110,7 @@ impl AccountsHashVerifier {
("handling-time-us", handling_time_us, i64), ("handling-time-us", handling_time_us, i64),
); );
} }
info!("Accounts Hash Verifier has stopped"); info!("AccountsHashVerifier has stopped");
}) })
.unwrap(); .unwrap();
Self { Self {

View File

@ -57,6 +57,7 @@ impl SnapshotPackagerService {
let t_snapshot_packager = Builder::new() let t_snapshot_packager = Builder::new()
.name("solSnapshotPkgr".to_string()) .name("solSnapshotPkgr".to_string())
.spawn(move || { .spawn(move || {
info!("SnapshotPackagerService has started");
renice_this_thread(snapshot_config.packager_thread_niceness_adj).unwrap(); renice_this_thread(snapshot_config.packager_thread_niceness_adj).unwrap();
let mut snapshot_gossip_manager = enable_gossip_push.then(|| let mut snapshot_gossip_manager = enable_gossip_push.then(||
SnapshotGossipManager::new( SnapshotGossipManager::new(
@ -122,7 +123,7 @@ impl SnapshotPackagerService {
("handling-time-us", handling_time_us, i64), ("handling-time-us", handling_time_us, i64),
); );
} }
info!("Snapshot Packager Service has stopped"); info!("SnapshotPackagerService has stopped");
}) })
.unwrap(); .unwrap();

View File

@ -533,7 +533,6 @@ impl AccountsBackgroundService {
test_hash_calculation: bool, test_hash_calculation: bool,
mut last_full_snapshot_slot: Option<Slot>, mut last_full_snapshot_slot: Option<Slot>,
) -> Self { ) -> Self {
info!("AccountsBackgroundService active");
let exit = exit.clone(); let exit = exit.clone();
let mut last_cleaned_block_height = 0; let mut last_cleaned_block_height = 0;
let mut removed_slots_count = 0; let mut removed_slots_count = 0;
@ -542,6 +541,7 @@ impl AccountsBackgroundService {
let t_background = Builder::new() let t_background = Builder::new()
.name("solBgAccounts".to_string()) .name("solBgAccounts".to_string())
.spawn(move || { .spawn(move || {
info!("AccountsBackgroundService has started");
let mut stats = StatsManager::new(); let mut stats = StatsManager::new();
let mut last_snapshot_end_time = None; let mut last_snapshot_end_time = None;
@ -656,12 +656,14 @@ impl AccountsBackgroundService {
stats.record_and_maybe_submit(start_time.elapsed()); stats.record_and_maybe_submit(start_time.elapsed());
sleep(Duration::from_millis(INTERVAL_MS)); sleep(Duration::from_millis(INTERVAL_MS));
} }
info!( debug!(
"ABS loop done. Number of snapshot storages kept alive for fastboot: {}", "Storages kept alive for fastboot: {}",
last_snapshot_storages last_snapshot_storages
.as_ref()
.map(|storages| storages.len()) .map(|storages| storages.len())
.unwrap_or(0) .unwrap_or(0)
); );
info!("AccountsBackgroundService has stopped");
}) })
.unwrap(); .unwrap();