Skip to content

Commit

Permalink
fix: re-download the repodata cache if is out of sync/corrupt (#466)
Browse files Browse the repository at this point in the history
Fixes prefix-dev/pixi#434

as a bonus, `ValidatedCacheState` now has `Debug`
  • Loading branch information
orhun authored Jan 5, 2024
1 parent d40d510 commit 59d00e4
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion crates/rattler_repodata_gateway/src/fetch/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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;
}
}
}
Expand Down

0 comments on commit 59d00e4

Please sign in to comment.