Uses AccountsBackgroundService::setup_bank_drop_callback() in tests (#31598)
This commit is contained in:
parent
a414b67b88
commit
93087324e3
|
@ -123,7 +123,8 @@ impl TestEnvironment {
|
||||||
SocketAddrSpace::Unspecified,
|
SocketAddrSpace::Unspecified,
|
||||||
));
|
));
|
||||||
|
|
||||||
let (pruned_banks_sender, pruned_banks_receiver) = crossbeam_channel::unbounded();
|
let pruned_banks_receiver =
|
||||||
|
AccountsBackgroundService::setup_bank_drop_callback(Arc::clone(&bank_forks));
|
||||||
let background_services = BackgroundServices::new(
|
let background_services = BackgroundServices::new(
|
||||||
Arc::clone(&exit),
|
Arc::clone(&exit),
|
||||||
Arc::clone(&cluster_info),
|
Arc::clone(&cluster_info),
|
||||||
|
@ -132,12 +133,6 @@ impl TestEnvironment {
|
||||||
Arc::clone(&bank_forks),
|
Arc::clone(&bank_forks),
|
||||||
);
|
);
|
||||||
let bank = bank_forks.read().unwrap().working_bank();
|
let bank = bank_forks.read().unwrap().working_bank();
|
||||||
bank.set_callback(Some(Box::new(
|
|
||||||
bank.rc
|
|
||||||
.accounts
|
|
||||||
.accounts_db
|
|
||||||
.create_drop_bank_callback(pruned_banks_sender),
|
|
||||||
)));
|
|
||||||
assert!(bank
|
assert!(bank
|
||||||
.feature_set
|
.feature_set
|
||||||
.is_active(&feature_set::epoch_accounts_hash::id()));
|
.is_active(&feature_set::epoch_accounts_hash::id()));
|
||||||
|
@ -159,7 +154,7 @@ impl TestEnvironment {
|
||||||
|
|
||||||
/// In order to shut down the background services correctly, each service's thread must be joined.
|
/// In order to shut down the background services correctly, each service's thread must be joined.
|
||||||
/// However, since `.join()` takes a `self` and `drop()` takes a `&mut self`, it means a "normal"
|
/// However, since `.join()` takes a `self` and `drop()` takes a `&mut self`, it means a "normal"
|
||||||
/// implementation of drop will no work. Instead, we must handle drop ourselves.
|
/// implementation of drop will not work. Instead, we must handle drop ourselves.
|
||||||
struct BackgroundServices {
|
struct BackgroundServices {
|
||||||
exit: Arc<AtomicBool>,
|
exit: Arc<AtomicBool>,
|
||||||
accounts_background_service: ManuallyDrop<AccountsBackgroundService>,
|
accounts_background_service: ManuallyDrop<AccountsBackgroundService>,
|
||||||
|
|
Loading…
Reference in New Issue