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:
Aditya Manthramurthy
2022-05-18 15:37:58 -07:00
committed by GitHub
parent 6cfb1cb6fd
commit 9aadd725d2
4 changed files with 10 additions and 14 deletions

View File

@@ -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.