From 59d00e445c4693540b24b0b2d46391d5fdd28294 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Orhun=20Parmaks=C4=B1z?= Date: Fri, 5 Jan 2024 10:15:07 +0100 Subject: [PATCH] fix: re-download the repodata cache if is out of sync/corrupt (#466) Fixes https://github.com/prefix-dev/pixi/issues/434 as a bonus, `ValidatedCacheState` now has `Debug` --- crates/rattler_repodata_gateway/src/fetch/mod.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/rattler_repodata_gateway/src/fetch/mod.rs b/crates/rattler_repodata_gateway/src/fetch/mod.rs index d2cfb6f21..634ef8eba 100644 --- a/crates/rattler_repodata_gateway/src/fetch/mod.rs +++ b/crates/rattler_repodata_gateway/src/fetch/mod.rs @@ -859,6 +859,7 @@ fn normalize_subdir_url(url: Url) -> Url { } /// A value returned from [`validate_cached_state`] which indicates the state of a repodata.json cache. +#[derive(Debug)] enum ValidatedCacheState { /// There is no cache, the cache could not be parsed, or the cache does not reference the same /// request. We can completely ignore any cached data. @@ -962,7 +963,7 @@ fn validate_cached_state( tracing::warn!( "BLAKE2 hash of repodata.json does not match cache state. Ignoring cached files..." ); - return ValidatedCacheState::Mismatched(cache_state); + return ValidatedCacheState::InvalidOrMissing; } } }