fs: multipart clean only trigger once (#4915)

master
fangyuxiang 7 years ago committed by Dee Koder
parent b74ef6d5f4
commit 8e4842b665
  1. 6
      cmd/fs-v1-multipart.go

@ -989,14 +989,14 @@ func (fs fsObjects) cleanupStaleMultipartUpload(bucket string, expiry time.Durat
// on all buckets for every `cleanupInterval`, this function is // on all buckets for every `cleanupInterval`, this function is
// blocking and should be run in a go-routine. // blocking and should be run in a go-routine.
func (fs fsObjects) cleanupStaleMultipartUploads(cleanupInterval, expiry time.Duration, doneCh chan struct{}) { func (fs fsObjects) cleanupStaleMultipartUploads(cleanupInterval, expiry time.Duration, doneCh chan struct{}) {
timer := time.NewTimer(cleanupInterval) ticker := time.NewTicker(cleanupInterval)
for { for {
select { select {
case <-doneCh: case <-doneCh:
// Stop the timer. // Stop the timer.
timer.Stop() ticker.Stop()
return return
case <-timer.C: case <-ticker.C:
bucketInfos, err := fs.ListBuckets() bucketInfos, err := fs.ListBuckets()
if err != nil { if err != nil {
errorIf(err, "Unable to list buckets") errorIf(err, "Unable to list buckets")

Loading…
Cancel
Save