diff --git a/cmd/bucket-replication-stats.go b/cmd/bucket-replication-stats.go index 70ebb642f..a3174fd51 100644 --- a/cmd/bucket-replication-stats.go +++ b/cmd/bucket-replication-stats.go @@ -169,19 +169,17 @@ func (r *ReplicationStats) loadInitialReplicationMetrics(ctx context.Context) { ) outer: for { - rTimer.Reset(time.Minute) select { case <-ctx.Done(): return case <-rTimer.C: dui, err = loadDataUsageFromBackend(GlobalContext, newObjectLayerFn()) - if err != nil { - continue - } // If LastUpdate is set, data usage is available. - if !dui.LastUpdate.IsZero() { + if err == nil && !dui.LastUpdate.IsZero() { break outer } + + rTimer.Reset(time.Minute) } } diff --git a/cmd/mrf.go b/cmd/mrf.go index 2e3081d1e..831adb838 100644 --- a/cmd/mrf.go +++ b/cmd/mrf.go @@ -190,12 +190,12 @@ func (m *mrfState) healRoutine() { } for { - idler.Reset(mrfInfoResetInterval) select { case <-m.ctx.Done(): return case <-idler.C: m.resetMRFInfoIfNoPendingOps() + idler.Reset(mrfInfoResetInterval) case setInfo := <-m.setReconnectEvent: // Get the list of objects related the er.set // to which the connected disk belongs. diff --git a/cmd/site-replication.go b/cmd/site-replication.go index e6a86362f..a05255570 100644 --- a/cmd/site-replication.go +++ b/cmd/site-replication.go @@ -3330,19 +3330,17 @@ func (c *SiteReplicationSys) startHealRoutine(ctx context.Context, objAPI Object defer healTimer.Stop() for { - healTimer.Reset(siteHealTimeInterval) - select { case <-healTimer.C: c.RLock() enabled := c.enabled c.RUnlock() - if !enabled { - continue + if enabled { + c.healIAMSystem(ctx, objAPI) // heal IAM system first + c.healBuckets(ctx, objAPI) // heal buckets subsequently } + healTimer.Reset(siteHealTimeInterval) - c.healIAMSystem(ctx, objAPI) // heal IAM system first - c.healBuckets(ctx, objAPI) // heal buckets subsequently case <-ctx.Done(): return } diff --git a/internal/dsync/drwmutex.go b/internal/dsync/drwmutex.go index 9cd077fd8..72f7aabbe 100644 --- a/internal/dsync/drwmutex.go +++ b/internal/dsync/drwmutex.go @@ -255,8 +255,6 @@ func (dm *DRWMutex) startContinousLockRefresh(lockLossCallback func(), id, sourc defer refreshTimer.Stop() for { - refreshTimer.Reset(dm.refreshInterval) - select { case <-ctx.Done(): return @@ -271,6 +269,8 @@ func (dm *DRWMutex) startContinousLockRefresh(lockLossCallback func(), id, sourc } return } + + refreshTimer.Reset(dm.refreshInterval) } } }()