AHV loop uses let-else (#30583)

This commit is contained in:
Brooks 2023-03-03 18:59:29 -07:00 committed by GitHub
parent 7a8563f2c8
commit 6972f92c29
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 34 additions and 34 deletions

View File

@ -61,14 +61,17 @@ impl AccountsHashVerifier {
break; break;
} }
if let Some(( let Some((
accounts_package, accounts_package,
num_outstanding_accounts_packages, num_outstanding_accounts_packages,
num_re_enqueued_accounts_packages, num_re_enqueued_accounts_packages,
)) = Self::get_next_accounts_package( )) = Self::get_next_accounts_package(
&accounts_package_sender, &accounts_package_sender,
&accounts_package_receiver, &accounts_package_receiver,
) { ) else {
std::thread::sleep(LOOP_LIMITER);
continue;
};
info!("handling accounts package: {accounts_package:?}"); info!("handling accounts package: {accounts_package:?}");
let enqueued_time = accounts_package.enqueued.elapsed(); let enqueued_time = accounts_package.enqueued.elapsed();
@ -99,9 +102,6 @@ impl AccountsHashVerifier {
("enqueued-time-us", enqueued_time.as_micros(), i64), ("enqueued-time-us", enqueued_time.as_micros(), i64),
("handling-time-us", handling_time_us, i64), ("handling-time-us", handling_time_us, i64),
); );
} else {
std::thread::sleep(LOOP_LIMITER);
}
} }
info!("Accounts Hash Verifier has stopped"); info!("Accounts Hash Verifier has stopped");
}) })