Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions backends/s3/s3.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,9 @@ func (b *Backend) List(ctx context.Context, prefix string) (blobList simpleblob.
combinedPrefix := b.prependGlobalPrefix(prefix)

if !b.opt.UseUpdateMarker {
ctx, cancel := b.clientTimeoutContext(ctx)
defer cancel()

return b.doList(ctx, combinedPrefix)
}

Expand All @@ -227,6 +230,9 @@ func (b *Backend) List(ctx context.Context, prefix string) (blobList simpleblob.
return blobs.WithPrefix(prefix), nil
}

ctx, cancel := b.clientTimeoutContext(ctx)
defer cancel()

blobs, err = b.doList(ctx, b.opt.GlobalPrefix) // We want to cache all, so no prefix
if err != nil {
return nil, err
Expand All @@ -247,8 +253,8 @@ func recordMinioDurationMetric(method string, start time.Time) {
}

func (b *Backend) doList(ctx context.Context, prefix string) (blobs simpleblob.BlobList, err error) {
ctx, cancel := b.clientTimeoutContext(ctx)
defer cancel()
metricCalls.WithLabelValues("list").Inc()
metricLastCallTimestamp.WithLabelValues("list").SetToCurrentTime()
defer recordMinioDurationMetric("list", time.Now())

// Runes to strip from blob names for GlobalPrefix
Expand All @@ -266,8 +272,6 @@ func (b *Backend) doList(ctx context.Context, prefix string) (blobs simpleblob.B
return nil, err
}

metricCalls.WithLabelValues("list").Inc()
metricLastCallTimestamp.WithLabelValues("list").SetToCurrentTime()
if obj.Key == b.markerName {
continue
}
Expand Down Expand Up @@ -315,7 +319,6 @@ func (b *Backend) Load(ctx context.Context, name string) ([]byte, error) {
func (b *Backend) doLoadReader(ctx context.Context, name string) (*minio.Object, error) {
metricCalls.WithLabelValues("load").Inc()
metricLastCallTimestamp.WithLabelValues("load").SetToCurrentTime()

defer recordMinioDurationMetric("load", time.Now())

obj, err := b.client.GetObject(ctx, b.opt.Bucket, name, minio.GetObjectOptions{})
Expand Down