Skip to content

Commit

Permalink
lru: do not fail removing file if already removed
Browse files Browse the repository at this point in the history
Closes #2092
  • Loading branch information
ahayzen-kdab committed Feb 17, 2025
1 parent e42fa94 commit 2a96a9f
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion src/lru_disk_cache/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,22 @@ impl LruDiskCache {
//TODO: check that files are removable during `init`, so that this is only
// due to outside interference.
fs::remove_file(&remove_path).unwrap_or_else(|e| {
panic!("Error removing file from cache: `{:?}`: {}", remove_path, e)
// Sometimes the file has already been removed
// this seems to happen when the max cache size has been reached
// https://github.com/mozilla/sccache/issues/2092
if e.kind() == std::io::ErrorKind::NotFound {
debug!(
"Error removing file from cache as it was not found: `{:?}`",
remove_path
);
} else {
panic!(
"Error removing file from cache: `{:?}`: {}, {:?}",
remove_path,
e,
e.kind()
)
}
});
}
Ok(())
Expand Down

0 comments on commit 2a96a9f

Please sign in to comment.