fix: drop guaranteed-miss S3 lookup in serveFromStore
ci/woodpecker/pr/pre-commit Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/pr/build Pipeline was successful

serveFromStore first called store.Download with the bare content hash as
the S3 key, which never matches real keys (blobs/sha256/<hash>), so every
cached blob serve paid an extra 404 round-trip before retrying with the
correct BlobKey. Remove the dead first attempt.

Refs #78
This commit is contained in:
2026-07-02 00:23:18 +10:00
parent 8d9bc1c422
commit 530c7a77fc
+1 -10
View File
@@ -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{