Skip to content

Commit

Permalink
Cleanup impl for remove_tmp_snapshot_archives() (solana-labs#32297)
Browse files Browse the repository at this point in the history
  • Loading branch information
brooksprumo authored and wen-coding committed Aug 15, 2023
1 parent eb4a21d commit aa9ad25
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions runtime/src/snapshot_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -623,11 +623,12 @@ fn is_bank_snapshot_complete(bank_snapshot_dir: impl AsRef<Path>) -> bool {
pub fn remove_tmp_snapshot_archives(snapshot_archives_dir: impl AsRef<Path>) {
if let Ok(entries) = std::fs::read_dir(snapshot_archives_dir) {
for entry in entries.flatten() {
let file_name = entry
if entry
.file_name()
.into_string()
.unwrap_or_else(|_| String::new());
if file_name.starts_with(TMP_SNAPSHOT_ARCHIVE_PREFIX) {
.to_str()
.map(|file_name| file_name.starts_with(TMP_SNAPSHOT_ARCHIVE_PREFIX))
.unwrap_or(false)
{
let path = entry.path();
let result = if path.is_dir() {
fs_err::remove_dir_all(path)
Expand Down

0 comments on commit aa9ad25

Please sign in to comment.