parallelize background cleanup on local disks across sets (#14290)

This commit is contained in:
Harshavardhana 2022-02-11 14:22:48 -08:00 committed by GitHub
parent ff99ef74c8
commit fad3d66093
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 20 additions and 2 deletions

View File

@ -508,9 +508,18 @@ func (s *erasureSets) cleanupDeletedObjects(ctx context.Context) {
// Reset for the next interval // Reset for the next interval
timer.Reset(globalAPIConfig.getDeleteCleanupInterval()) timer.Reset(globalAPIConfig.getDeleteCleanupInterval())
var wg sync.WaitGroup
for _, set := range s.sets { for _, set := range s.sets {
set.cleanupDeletedObjects(ctx) wg.Add(1)
go func(set *erasureObjects) {
defer wg.Done()
if set == nil {
return
} }
set.cleanupDeletedObjects(ctx)
}(set)
}
wg.Wait()
} }
} }
} }
@ -527,9 +536,18 @@ func (s *erasureSets) cleanupStaleUploads(ctx context.Context) {
// Reset for the next interval // Reset for the next interval
timer.Reset(globalAPIConfig.getStaleUploadsCleanupInterval()) timer.Reset(globalAPIConfig.getStaleUploadsCleanupInterval())
var wg sync.WaitGroup
for _, set := range s.sets { for _, set := range s.sets {
set.cleanupStaleUploads(ctx, globalAPIConfig.getStaleUploadsExpiry()) wg.Add(1)
go func(set *erasureObjects) {
defer wg.Done()
if set == nil {
return
} }
set.cleanupStaleUploads(ctx, globalAPIConfig.getStaleUploadsExpiry())
}(set)
}
wg.Wait()
} }
} }
} }