mirror of
https://github.com/minio/minio.git
synced 2024-12-24 06:05:55 -05:00
Avoid calling .Reset() on active timer (#14941)
.Reset() documentation states: For a Timer created with NewTimer, Reset should be invoked only on stopped or expired timers with drained channels. This change is just to comply with this requirement as there might be some runtime dependent situation that might lead to unexpected behavior.
This commit is contained in:
parent
6cfb1cb6fd
commit
9aadd725d2
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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.
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
}()
|
||||
|
Loading…
Reference in New Issue
Block a user