summaryrefslogtreecommitdiff
path: root/vendor/k8s.io/apimachinery/pkg/util/runtime
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/k8s.io/apimachinery/pkg/util/runtime')
-rw-r--r--vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go6
1 files changed, 4 insertions, 2 deletions
diff --git a/vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go b/vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go
index 748174e19..d4cec0b88 100644
--- a/vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go
+++ b/vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go
@@ -43,7 +43,7 @@ var PanicHandlers = []func(interface{}){logPanic}
// TODO: remove this function. We are switching to a world where it's safe for
// apiserver to panic, since it will be restarted by kubelet. At the beginning
// of the Kubernetes project, nothing was going to restart apiserver and so
-// catching panics was important. But it's actually much simpler for montoring
+// catching panics was important. But it's actually much simpler for monitoring
// software if we just exit when an unexpected panic happens.
func HandleCrash(additionalHandlers ...func(interface{})) {
if r := recover(); r != nil {
@@ -128,7 +128,9 @@ func (r *rudimentaryErrorBackoff) OnError(error) {
r.lastErrorTimeLock.Lock()
defer r.lastErrorTimeLock.Unlock()
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)
}
r.lastErrorTime = time.Now()