-
Kubernetes Submit Queue authored
Automatic merge from submit-queue (batch tested with PRs 52717, 54568, 54452, 53997, 54237). If you want to cherry-pick this change to another branch, please follow the instructions <a href="https://github.com/kubernetes/community/blob/master/contributors/devel/cherry-picks.md">here</a>. Fix bug in func OnError() of apimachinery in case time moves backwards for any reason **What this PR does / why we need it**: in func OnError() of ErrorHandlers in apimachinery ``` func (r *rudimentaryErrorBackoff) OnError(error) { r.lastErrorTimeLock.Lock() defer r.lastErrorTimeLock.Unlock() d := time.Since(r.lastErrorTime) if d < 0 { time.Sleep(r.minPeriod - d) } r.lastErrorTime = time.Now() } ``` it is expected to go on sleep for some time if not meet the minPeriod. However, if time happens hops to the past in the process. `d := time.Since(r.lastErrorTime)` would be a negative number, thus, it may sleep a lot longer than we expected. The period for sleep should be reseted if time hops **Which issue this PR fixes** fixes #54236 **Release note**: ```release-note NONE ```
52d87de1