Skip to content

Commit

Permalink
fix(warg): Removes call to cache for versions
Browse files Browse the repository at this point in the history
The implementation for listing versions was pulling from the cache. This
caused it to miss updates to versions when being used in cargo-component.

I discovered this while working on cargo-component and it was blocking
tests from working

Signed-off-by: Taylor Thomas <taylor@cosmonic.com>
  • Loading branch information
thomastaylor312 committed Jul 16, 2024
1 parent 4c0ba9f commit 5376a27
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions crates/wasm-pkg-client/src/warg/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,16 @@ impl WargBackend {
package: &PackageRef,
) -> Result<PackageInfo, Error> {
let package_name = package_ref_to_name(package)?;
// NOTE(thomastaylor312): We need to make sure we're up to date with all packages, but if we
// bypass the cache every time, we'll have to fetch the whole package log every time rather
// than loading from cache on disk. The remaining question here is the performance impact.
// At scale, we don't know if this will result in a lot of HTTP requests even though the
// packages were updated on a previous call. This should be good enough for now, but we
// might need to revisit this later.
self.client
.update()
.await
.map_err(|e| Error::RegistryError(e.into()))?;
self.client
.package(&package_name)
.await
Expand Down

0 comments on commit 5376a27

Please sign in to comment.