mirror of
https://github.com/minio/minio.git
synced 2024-12-24 22:25:54 -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:
|
||||
update()
|
||||
// Enforce quotas when all is done.
|
||||
for _, b := range allBuckets {
|
||||
enforceFIFOQuotaBucket(ctx, z, b.Name, allMerged.bucketUsageInfo(b.Name))
|
||||
if firstErr == nil {
|
||||
for _, b := range allBuckets {
|
||||
enforceFIFOQuotaBucket(ctx, z, b.Name, allMerged.bucketUsageInfo(b.Name))
|
||||
}
|
||||
}
|
||||
close(v)
|
||||
return
|
||||
@ -388,6 +390,9 @@ func (z *erasureZones) CrawlAndGetDataUsage(ctx context.Context, bf *bloomFilter
|
||||
case updateCloser <- ch:
|
||||
<-ch
|
||||
case <-ctx.Done():
|
||||
if firstErr == nil {
|
||||
firstErr = ctx.Err()
|
||||
}
|
||||
}
|
||||
return firstErr
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user