From b1ef57d32a14ca7681acb4e8e1af383792ec6e17 Mon Sep 17 00:00:00 2001 From: Catherine Date: Tue, 30 Sep 2025 03:44:24 +0000 Subject: [PATCH] Only cache NotFound errors from S3 backend, rather than any errors. We need to cache NotFound responses to avoid hitting the backend whenever there's a flurry of requests for the same invalid domain. But caching any kind of error, including context cancellation, results in poisoning the cache with that error, e.g. if the domain exists but the client that requested it first did not wait for the response. --- src/backend_s3.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/backend_s3.go b/src/backend_s3.go index eee9120..712d0e6 100644 --- a/src/backend_s3.go +++ b/src/backend_s3.go @@ -312,8 +312,10 @@ func (s3 *S3Backend) GetManifest(ctx context.Context, name string) (*Manifest, e if err != nil { if errResp := minio.ToErrorResponse(err); errResp.Code == "NoSuchKey" { err = fmt.Errorf("%w: %s", errNotFound, errResp.Key) + return &CachedManifest{nil, 1, err}, nil + } else { + return nil, err } - return &CachedManifest{nil, 1, err}, nil } else { return &CachedManifest{manifest, size, err}, nil }