fork of whitequark.org/git-pages with mods for tangled

Fix a regression causing non-observance of ≠200 S3 manifest responses.

Introduced in commit dd168186.

Changed files
+9 -10
src
+9 -10
src/backend_s3.go
··· 396 396 } 397 397 398 398 func (l s3ManifestLoader) load(ctx context.Context, name string, oldManifest *CachedManifest) (*CachedManifest, error) { 399 - loader := func() (*CachedManifest, error) { 400 - log.Printf("s3: get manifest %s\n", name) 401 - 402 - startTime := time.Now() 399 + log.Printf("s3: get manifest %s\n", name) 403 400 401 + loader := func() (*CachedManifest, error) { 404 402 opts := minio.GetObjectOptions{} 405 403 if oldManifest != nil && oldManifest.etag != "" { 406 404 opts.SetMatchETagExcept(oldManifest.etag) ··· 427 425 return nil, err 428 426 } 429 427 430 - s3GetObjectDurationSeconds. 431 - With(prometheus.Labels{"kind": "manifest"}). 432 - Observe(time.Since(startTime).Seconds()) 433 - 434 428 return &CachedManifest{manifest, uint32(len(data)), stat.LastModified, stat.ETag, nil}, nil 435 429 } 436 430 437 - var cached *CachedManifest 431 + startTime := time.Now() 438 432 cached, err := loader() 433 + s3GetObjectDurationSeconds. 434 + With(prometheus.Labels{"kind": "manifest"}). 435 + Observe(time.Since(startTime).Seconds()) 436 + 439 437 if err != nil { 440 - if errResp := minio.ToErrorResponse(err); errResp.Code == "NoSuchKey" { 438 + errResp := minio.ToErrorResponse(err) 439 + if errResp.Code == "NoSuchKey" { 441 440 s3GetObjectErrorsCount.With(prometheus.Labels{"object_kind": "manifest"}).Inc() 442 441 err = fmt.Errorf("%w: %s", ErrObjectNotFound, errResp.Key) 443 442 return &CachedManifest{nil, 1, time.Time{}, "", err}, nil