@@ -71,6 +71,7 @@ use std::{
71
71
} ;
72
72
use tempfile:: TempDir ;
73
73
74
+ #[ cfg( test) ]
74
75
use std:: { thread:: sleep, time:: Duration } ;
75
76
76
77
const PAGE_SIZE : u64 = 4 * 1024 ;
@@ -5503,31 +5504,7 @@ impl AccountsDb {
5503
5504
}
5504
5505
}
5505
5506
5506
- /// sleep while accounts cache size has grown too large, up to a max wait
5507
- fn maybe_stall_store_cached ( & self , accounts : & [ ( & Pubkey , & AccountSharedData ) ] ) {
5508
- const MAX_DELAY_US : u128 = 10_000 ;
5509
- const CACHE_SIZE_TO_STALL : u64 = 10_000_000_000 ;
5510
- const DELAY_US : u64 = 1_000 ;
5511
- let start = Instant :: now ( ) ;
5512
- let mut waited = false ;
5513
- while self . accounts_cache . size ( ) > CACHE_SIZE_TO_STALL {
5514
- waited = true ;
5515
- sleep ( Duration :: from_micros ( DELAY_US ) ) ;
5516
- if start. elapsed ( ) . as_micros ( ) > MAX_DELAY_US {
5517
- break ;
5518
- }
5519
- }
5520
- if waited {
5521
- datapoint_info ! (
5522
- "accounts_db_store_cached_stall" ,
5523
- ( "num_accounts" , accounts. len( ) , i64 ) ,
5524
- ( "delay_us" , start. elapsed( ) . as_micros( ) , i64 ) ,
5525
- ) ;
5526
- }
5527
- }
5528
-
5529
5507
pub fn store_cached ( & self , slot : Slot , accounts : & [ ( & Pubkey , & AccountSharedData ) ] ) {
5530
- self . maybe_stall_store_cached ( accounts) ;
5531
5508
self . store ( slot, accounts, self . caching_enabled ) ;
5532
5509
}
5533
5510
0 commit comments