From 444cfef5f127e1cad506c9bc8a9b1d4eb1a39a94 Mon Sep 17 00:00:00 2001 From: Mike Landau Date: Tue, 14 May 2024 22:59:29 -0700 Subject: [PATCH] Revert "[perf] Skip cache check if store path exists locally (#2042)" This reverts commit ec0a7036903076037f864e2e80cba0acbf4d061e. --- internal/devpkg/narinfo_cache.go | 8 -------- 1 file changed, 8 deletions(-) diff --git a/internal/devpkg/narinfo_cache.go b/internal/devpkg/narinfo_cache.go index 49b8aadf324..1b420a44dd3 100644 --- a/internal/devpkg/narinfo_cache.go +++ b/internal/devpkg/narinfo_cache.go @@ -5,13 +5,11 @@ import ( "fmt" "io" "net/http" - "os" "sync" "time" "github.com/pkg/errors" "go.jetpack.io/devbox/internal/boxcli/featureflag" - "go.jetpack.io/devbox/internal/debug" "go.jetpack.io/devbox/internal/lock" "go.jetpack.io/devbox/internal/nix" "golang.org/x/sync/errgroup" @@ -53,7 +51,6 @@ func (p *Package) IsInBinaryCache() (bool, error) { // package in the list, and caches the result. // Callers of IsInBinaryCache may call this function first as a perf-optimization. func FillNarInfoCache(ctx context.Context, packages ...*Package) error { - defer debug.FunctionTimer().End() if !featureflag.RemoveNixpkgs.Enabled() { return nil } @@ -148,11 +145,6 @@ func (p *Package) fetchNarInfoStatus(outputName string) (bool, error) { outputInCache := map[string]bool{} // key = output name, value = in cache for _, output := range outputs { - // if store path exists locally, then it is equivalent to being in the cache. - if _, err := os.Stat(output.Path); err == nil { - outputInCache[output.Name] = true - continue - } pathParts := nix.NewStorePathParts(output.Path) reqURL := BinaryCache + "/" + pathParts.Hash + ".narinfo" ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)