fix: two different scanner update races (#12615)

This commit is contained in:
Klaus Post
2021-07-02 11:19:56 -07:00
committed by GitHub
parent f706671568
commit a7e2a1a38b
2 changed files with 8 additions and 3 deletions
+3 -3
View File
@@ -484,11 +484,11 @@ func (er erasureObjects) nsScanner(ctx context.Context, buckets []BucketInfo, bf
updates := make(chan dataUsageEntry, 1)
var wg sync.WaitGroup
wg.Add(1)
go func() {
go func(name string) {
defer wg.Done()
for update := range updates {
bucketResults <- dataUsageEntryInfo{
Name: cache.Info.Name,
Name: name,
Parent: dataUsageRoot,
Entry: update,
}
@@ -496,7 +496,7 @@ func (er erasureObjects) nsScanner(ctx context.Context, buckets []BucketInfo, bf
console.Debugln("bucket", bucket.Name, "got update", update)
}
}
}()
}(cache.Info.Name)
// Calc usage
before := cache.Info.LastUpdate