From 72b73a506b9eb3335bc2897dd6a725155b82f27f Mon Sep 17 00:00:00 2001 From: Charlie Marsh Date: Thu, 5 Sep 2024 23:09:29 -0400 Subject: [PATCH] Add distinctive logging for cache prune phases (#7114) --- crates/uv-cache/src/lib.rs | 8 ++++---- crates/uv/tests/cache_prune.rs | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/crates/uv-cache/src/lib.rs b/crates/uv-cache/src/lib.rs index e2810b156..cc1305526 100644 --- a/crates/uv-cache/src/lib.rs +++ b/crates/uv-cache/src/lib.rs @@ -404,13 +404,13 @@ impl Cache { // If the directory is not a cache bucket, remove it. if CacheBucket::iter().all(|bucket| entry.file_name() != bucket.to_str()) { let path = entry.path(); - debug!("Removing dangling cache entry: {}", path.display()); + debug!("Removing dangling cache bucket: {}", path.display()); summary += rm_rf(path)?; } } else { // If the file is not a marker file, remove it. let path = entry.path(); - debug!("Removing dangling cache entry: {}", path.display()); + debug!("Removing dangling cache bucket: {}", path.display()); summary += rm_rf(path)?; } } @@ -422,7 +422,7 @@ impl Cache { for entry in entries { let entry = entry?; let path = fs_err::canonicalize(entry.path())?; - debug!("Removing dangling cache entry: {}", path.display()); + debug!("Removing dangling cache environment: {}", path.display()); summary += rm_rf(path)?; } } @@ -481,7 +481,7 @@ impl Cache { let entry = entry?; let path = fs_err::canonicalize(entry.path())?; if !references.contains(&path) { - debug!("Removing dangling cache entry: {}", path.display()); + debug!("Removing dangling cache archive: {}", path.display()); summary += rm_rf(path)?; } } diff --git a/crates/uv/tests/cache_prune.rs b/crates/uv/tests/cache_prune.rs index 84c745e2f..1f530936f 100644 --- a/crates/uv/tests/cache_prune.rs +++ b/crates/uv/tests/cache_prune.rs @@ -66,7 +66,7 @@ fn prune_stale_directory() -> Result<()> { ----- stderr ----- DEBUG uv [VERSION] ([COMMIT] DATE) Pruning cache at: [CACHE_DIR]/ - DEBUG Removing dangling cache entry: [CACHE_DIR]/simple-v4 + DEBUG Removing dangling cache bucket: [CACHE_DIR]/simple-v4 Removed 1 directory "###); @@ -120,8 +120,8 @@ fn prune_cached_env() { ----- stderr ----- DEBUG uv [VERSION] ([COMMIT] DATE) Pruning cache at: [CACHE_DIR]/ - DEBUG Removing dangling cache entry: [CACHE_DIR]/environments-v1/[ENTRY] - DEBUG Removing dangling cache entry: [CACHE_DIR]/archive-v0/[ENTRY] + DEBUG Removing dangling cache environment: [CACHE_DIR]/environments-v1/[ENTRY] + DEBUG Removing dangling cache archive: [CACHE_DIR]/archive-v0/[ENTRY] Removed [N] files ([SIZE]) "###); } @@ -165,7 +165,7 @@ fn prune_stale_symlink() -> Result<()> { ----- stderr ----- DEBUG uv [VERSION] ([COMMIT] DATE) Pruning cache at: [CACHE_DIR]/ - DEBUG Removing dangling cache entry: [CACHE_DIR]/archive-v0/[ENTRY] + DEBUG Removing dangling cache archive: [CACHE_DIR]/archive-v0/[ENTRY] Removed 44 files ([SIZE]) "###); @@ -330,7 +330,7 @@ fn prune_stale_revision() -> Result<()> { DEBUG uv [VERSION] ([COMMIT] DATE) Pruning cache at: [CACHE_DIR]/ DEBUG Removing dangling source revision: [CACHE_DIR]/built-wheels-v3/[ENTRY] - DEBUG Removing dangling cache entry: [CACHE_DIR]/archive-v0/[ENTRY] + DEBUG Removing dangling cache archive: [CACHE_DIR]/archive-v0/[ENTRY] Removed 8 files ([SIZE]) "###);