From a52f44c34279fe7b1ad02a00b070b914b58c793e Mon Sep 17 00:00:00 2001 From: Xiang Zhu Date: Thu, 27 Apr 2023 18:13:34 -0700 Subject: [PATCH] Use async delete to save time and gracefully handle missing dir (#31380) --- runtime/src/snapshot_utils.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/src/snapshot_utils.rs b/runtime/src/snapshot_utils.rs index 6a86ea205..0a3832476 100644 --- a/runtime/src/snapshot_utils.rs +++ b/runtime/src/snapshot_utils.rs @@ -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)?;