From eec69d679678ce95de2d6ab2404058a12736b46f Mon Sep 17 00:00:00 2001 From: Klaus Post Date: Wed, 23 Sep 2020 08:30:31 -0700 Subject: [PATCH] Fix stale context for bucket retrieval (#10551) The provided context gets captured by the closure making all subsequent calls fail. --- cmd/bucket-quota.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cmd/bucket-quota.go b/cmd/bucket-quota.go index 1b7d6e6db..6a9307f83 100644 --- a/cmd/bucket-quota.go +++ b/cmd/bucket-quota.go @@ -71,6 +71,8 @@ func (sys *BucketQuotaSys) check(ctx context.Context, bucket string, size int64) sys.bucketStorageCache.Once.Do(func() { sys.bucketStorageCache.TTL = 1 * time.Second sys.bucketStorageCache.Update = func() (interface{}, error) { + ctx, done := context.WithTimeout(context.Background(), 5*time.Second) + defer done() return loadDataUsageFromBackend(ctx, objAPI) } })