Ensure proper stale_uploads_cleanup_interval is used at all times (#20451)

This commit is contained in:
Ramon de Klein 2024-09-18 19:59:26 +02:00 committed by GitHub
parent fa5d9c02ef
commit 48a591e9b4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 16 additions and 4 deletions

View File

@ -86,6 +86,8 @@ type erasureSets struct {
lastConnectDisksOpTime time.Time lastConnectDisksOpTime time.Time
} }
var staleUploadsCleanupIntervalChangedCh = make(chan struct{})
func (s *erasureSets) getDiskMap() map[Endpoint]StorageAPI { func (s *erasureSets) getDiskMap() map[Endpoint]StorageAPI {
diskMap := make(map[Endpoint]StorageAPI) diskMap := make(map[Endpoint]StorageAPI)
@ -532,10 +534,11 @@ func (s *erasureSets) cleanupStaleUploads(ctx context.Context) {
}(set) }(set)
} }
wg.Wait() wg.Wait()
case <-staleUploadsCleanupIntervalChangedCh:
// Reset for the next interval
timer.Reset(globalAPIConfig.getStaleUploadsCleanupInterval())
} }
// Reset for the next interval
timer.Reset(globalAPIConfig.getStaleUploadsCleanupInterval())
} }
} }

View File

@ -183,13 +183,22 @@ func (t *apiConfig) init(cfg api.Config, setDriveCounts []int, legacy bool) {
t.transitionWorkers = cfg.TransitionWorkers t.transitionWorkers = cfg.TransitionWorkers
t.staleUploadsExpiry = cfg.StaleUploadsExpiry t.staleUploadsExpiry = cfg.StaleUploadsExpiry
t.staleUploadsCleanupInterval = cfg.StaleUploadsCleanupInterval
t.deleteCleanupInterval = cfg.DeleteCleanupInterval t.deleteCleanupInterval = cfg.DeleteCleanupInterval
t.enableODirect = cfg.EnableODirect t.enableODirect = cfg.EnableODirect
t.gzipObjects = cfg.GzipObjects t.gzipObjects = cfg.GzipObjects
t.rootAccess = cfg.RootAccess t.rootAccess = cfg.RootAccess
t.syncEvents = cfg.SyncEvents t.syncEvents = cfg.SyncEvents
t.objectMaxVersions = cfg.ObjectMaxVersions t.objectMaxVersions = cfg.ObjectMaxVersions
if t.staleUploadsCleanupInterval != cfg.StaleUploadsCleanupInterval {
t.staleUploadsCleanupInterval = cfg.StaleUploadsCleanupInterval
// signal that cleanup interval has changed
select {
case staleUploadsCleanupIntervalChangedCh <- struct{}{}:
default: // in case the channel is blocked...
}
}
} }
func (t *apiConfig) odirectEnabled() bool { func (t *apiConfig) odirectEnabled() bool {