mirror of
https://github.com/minio/minio.git
synced 2025-01-11 23:13:23 -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:
|
outer:
|
||||||
for {
|
for {
|
||||||
rTimer.Reset(time.Minute)
|
|
||||||
select {
|
select {
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
return
|
return
|
||||||
case <-rTimer.C:
|
case <-rTimer.C:
|
||||||
dui, err = loadDataUsageFromBackend(GlobalContext, newObjectLayerFn())
|
dui, err = loadDataUsageFromBackend(GlobalContext, newObjectLayerFn())
|
||||||
if err != nil {
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
// If LastUpdate is set, data usage is available.
|
// If LastUpdate is set, data usage is available.
|
||||||
if !dui.LastUpdate.IsZero() {
|
if err == nil && !dui.LastUpdate.IsZero() {
|
||||||
break outer
|
break outer
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rTimer.Reset(time.Minute)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -190,12 +190,12 @@ func (m *mrfState) healRoutine() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for {
|
for {
|
||||||
idler.Reset(mrfInfoResetInterval)
|
|
||||||
select {
|
select {
|
||||||
case <-m.ctx.Done():
|
case <-m.ctx.Done():
|
||||||
return
|
return
|
||||||
case <-idler.C:
|
case <-idler.C:
|
||||||
m.resetMRFInfoIfNoPendingOps()
|
m.resetMRFInfoIfNoPendingOps()
|
||||||
|
idler.Reset(mrfInfoResetInterval)
|
||||||
case setInfo := <-m.setReconnectEvent:
|
case setInfo := <-m.setReconnectEvent:
|
||||||
// Get the list of objects related the er.set
|
// Get the list of objects related the er.set
|
||||||
// to which the connected disk belongs.
|
// to which the connected disk belongs.
|
||||||
|
@ -3330,19 +3330,17 @@ func (c *SiteReplicationSys) startHealRoutine(ctx context.Context, objAPI Object
|
|||||||
defer healTimer.Stop()
|
defer healTimer.Stop()
|
||||||
|
|
||||||
for {
|
for {
|
||||||
healTimer.Reset(siteHealTimeInterval)
|
|
||||||
|
|
||||||
select {
|
select {
|
||||||
case <-healTimer.C:
|
case <-healTimer.C:
|
||||||
c.RLock()
|
c.RLock()
|
||||||
enabled := c.enabled
|
enabled := c.enabled
|
||||||
c.RUnlock()
|
c.RUnlock()
|
||||||
if !enabled {
|
if enabled {
|
||||||
continue
|
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():
|
case <-ctx.Done():
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -255,8 +255,6 @@ func (dm *DRWMutex) startContinousLockRefresh(lockLossCallback func(), id, sourc
|
|||||||
defer refreshTimer.Stop()
|
defer refreshTimer.Stop()
|
||||||
|
|
||||||
for {
|
for {
|
||||||
refreshTimer.Reset(dm.refreshInterval)
|
|
||||||
|
|
||||||
select {
|
select {
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
return
|
return
|
||||||
@ -271,6 +269,8 @@ func (dm *DRWMutex) startContinousLockRefresh(lockLossCallback func(), id, sourc
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
refreshTimer.Reset(dm.refreshInterval)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
Loading…
Reference in New Issue
Block a user