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