Takes inner HashSet when dropping CacheHashData (#33169)
This commit is contained in:
parent
a80819b029
commit
a3dc3eb37c
|
@ -226,12 +226,12 @@ impl CacheHashData {
|
||||||
result
|
result
|
||||||
}
|
}
|
||||||
fn delete_old_cache_files(&self) {
|
fn delete_old_cache_files(&self) {
|
||||||
let pre_existing_cache_files = self.pre_existing_cache_files.lock().unwrap();
|
let old_cache_files = std::mem::take(&mut *self.pre_existing_cache_files.lock().unwrap());
|
||||||
if !pre_existing_cache_files.is_empty() {
|
if !old_cache_files.is_empty() {
|
||||||
self.stats
|
self.stats
|
||||||
.unused_cache_files
|
.unused_cache_files
|
||||||
.fetch_add(pre_existing_cache_files.len(), Ordering::Relaxed);
|
.fetch_add(old_cache_files.len(), Ordering::Relaxed);
|
||||||
for file_name in pre_existing_cache_files.iter() {
|
for file_name in old_cache_files.iter() {
|
||||||
let result = self.cache_dir.join(file_name);
|
let result = self.cache_dir.join(file_name);
|
||||||
let _ = fs::remove_file(result);
|
let _ = fs::remove_file(result);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue