mirror of
https://github.com/minio/minio.git
synced 2025-01-12 15:33:22 -05:00
Only enforce quota on success (#10339)
We should only enforce quotas if no error has been returned. firstErr is safe to access since all goroutines have exited at this point. If `firstErr` hasn't been set by something else return the context error if cancelled.
This commit is contained in:
parent
21e8440423
commit
bc2ebe0021
@ -371,8 +371,10 @@ func (z *erasureZones) CrawlAndGetDataUsage(ctx context.Context, bf *bloomFilter
|
|||||||
case v := <-updateCloser:
|
case v := <-updateCloser:
|
||||||
update()
|
update()
|
||||||
// Enforce quotas when all is done.
|
// Enforce quotas when all is done.
|
||||||
for _, b := range allBuckets {
|
if firstErr == nil {
|
||||||
enforceFIFOQuotaBucket(ctx, z, b.Name, allMerged.bucketUsageInfo(b.Name))
|
for _, b := range allBuckets {
|
||||||
|
enforceFIFOQuotaBucket(ctx, z, b.Name, allMerged.bucketUsageInfo(b.Name))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
close(v)
|
close(v)
|
||||||
return
|
return
|
||||||
@ -388,6 +390,9 @@ func (z *erasureZones) CrawlAndGetDataUsage(ctx context.Context, bf *bloomFilter
|
|||||||
case updateCloser <- ch:
|
case updateCloser <- ch:
|
||||||
<-ch
|
<-ch
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
|
if firstErr == nil {
|
||||||
|
firstErr = ctx.Err()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return firstErr
|
return firstErr
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user