From 530c7a77fc814dcb33f5198d99277849063a371a Mon Sep 17 00:00:00 2001 From: Ben Vincent Date: Thu, 2 Jul 2026 00:23:18 +1000 Subject: [PATCH] fix: drop guaranteed-miss S3 lookup in serveFromStore serveFromStore first called store.Download with the bare content hash as the S3 key, which never matches real keys (blobs/sha256/), so every cached blob serve paid an extra 404 round-trip before retrying with the correct BlobKey. Remove the dead first attempt. Refs #78 --- internal/proxy/engine.go | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/internal/proxy/engine.go b/internal/proxy/engine.go index ba63e78..c7dbc72 100644 --- a/internal/proxy/engine.go +++ b/internal/proxy/engine.go @@ -250,17 +250,8 @@ func (e *Engine) fetchFromUpstream(ctx context.Context, remote models.Remote, pa func (e *Engine) serveFromStore(ctx context.Context, remote models.Remote, path string) (*FetchResult, error) { artifact, err := e.db.GetArtifact(ctx, remote.Name, path) if err == nil && artifact != nil { - reader, info, err := e.store.Download(ctx, artifact.ContentHash[len("sha256:"):]) - if err == nil { - _ = e.db.TouchArtifactAccess(ctx, remote.Name, path) - return &FetchResult{ - Reader: reader, - ContentType: info.ContentType, - Size: info.Size, - }, nil - } s3Key := storage.BlobKey(artifact.ContentHash[len("sha256:"):]) - reader, info, err = e.store.Download(ctx, s3Key) + reader, info, err := e.store.Download(ctx, s3Key) if err == nil { _ = e.db.TouchArtifactAccess(ctx, remote.Name, path) return &FetchResult{