Use async delete to save time and gracefully handle missing dir (#31380)

This commit is contained in:
Xiang Zhu 2023-04-27 18:13:34 -07:00 committed by GitHub
parent 6f014710ff
commit a52f44c342
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -1229,7 +1229,7 @@ pub fn add_bank_snapshot(
.join(&slot_str);
if account_snapshot_path.is_dir() {
// remove the account snapshot directory
fs::remove_dir_all(&account_snapshot_path)?;
move_and_async_delete_path(&account_snapshot_path);
}
}
}
@ -1354,7 +1354,7 @@ where
// They should all be removed.
for entry in fs::read_dir(accounts_hardlinks_dir)? {
let dst_path = fs::read_link(entry?.path())?;
fs::remove_dir_all(dst_path)?;
move_and_async_delete_path(&dst_path);
}
}
fs::remove_dir_all(bank_snapshot_dir)?;