Commit d3b935a4 authored by lichuqiang's avatar lichuqiang

fix bug in OnError() of apimachinery

parent 194f3983
...@@ -128,7 +128,9 @@ func (r *rudimentaryErrorBackoff) OnError(error) { ...@@ -128,7 +128,9 @@ func (r *rudimentaryErrorBackoff) OnError(error) {
r.lastErrorTimeLock.Lock() r.lastErrorTimeLock.Lock()
defer r.lastErrorTimeLock.Unlock() defer r.lastErrorTimeLock.Unlock()
d := time.Since(r.lastErrorTime) d := time.Since(r.lastErrorTime)
if d < r.minPeriod { if d < r.minPeriod && d >= 0 {
// If the time moves backwards for any reason, do nothing
// TODO: remove check "d >= 0" after go 1.8 is no longer supported
time.Sleep(r.minPeriod - d) time.Sleep(r.minPeriod - d)
} }
r.lastErrorTime = time.Now() r.lastErrorTime = time.Now()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment