Skip to content

Commit

Permalink
Takes inner HashSet when dropping CacheHashData (#33169)
Browse files Browse the repository at this point in the history
  • Loading branch information
brooksprumo authored Sep 6, 2023
1 parent a80819b commit a3dc3eb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions accounts-db/src/cache_hash_data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -226,12 +226,12 @@ impl CacheHashData {
result
}
fn delete_old_cache_files(&self) {
let pre_existing_cache_files = self.pre_existing_cache_files.lock().unwrap();
if !pre_existing_cache_files.is_empty() {
let old_cache_files = std::mem::take(&mut *self.pre_existing_cache_files.lock().unwrap());
if !old_cache_files.is_empty() {
self.stats
.unused_cache_files
.fetch_add(pre_existing_cache_files.len(), Ordering::Relaxed);
for file_name in pre_existing_cache_files.iter() {
.fetch_add(old_cache_files.len(), Ordering::Relaxed);
for file_name in old_cache_files.iter() {
let result = self.cache_dir.join(file_name);
let _ = fs::remove_file(result);
}
Expand Down

0 comments on commit a3dc3eb

Please sign in to comment.