mirror of
https://github.com/ceph/ceph-csi.git
synced 2025-06-13 10:33:35 +00:00
Fresh dep ensure
This commit is contained in:
20
vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go
generated
vendored
20
vendor/k8s.io/apimachinery/pkg/util/runtime/runtime.go
generated
vendored
@ -22,7 +22,7 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/golang/glog"
|
||||
"k8s.io/klog"
|
||||
)
|
||||
|
||||
var (
|
||||
@ -63,7 +63,11 @@ func HandleCrash(additionalHandlers ...func(interface{})) {
|
||||
// logPanic logs the caller tree when a panic occurs.
|
||||
func logPanic(r interface{}) {
|
||||
callers := getCallers(r)
|
||||
glog.Errorf("Observed a panic: %#v (%v)\n%v", r, r, callers)
|
||||
if _, ok := r.(string); ok {
|
||||
klog.Errorf("Observed a panic: %s\n%v", r, callers)
|
||||
} else {
|
||||
klog.Errorf("Observed a panic: %#v (%v)\n%v", r, r, callers)
|
||||
}
|
||||
}
|
||||
|
||||
func getCallers(r interface{}) string {
|
||||
@ -111,7 +115,7 @@ func HandleError(err error) {
|
||||
|
||||
// logError prints an error with the call stack of the location it was reported
|
||||
func logError(err error) {
|
||||
glog.ErrorDepth(2, err)
|
||||
klog.ErrorDepth(2, err)
|
||||
}
|
||||
|
||||
type rudimentaryErrorBackoff struct {
|
||||
@ -128,9 +132,8 @@ func (r *rudimentaryErrorBackoff) OnError(error) {
|
||||
r.lastErrorTimeLock.Lock()
|
||||
defer r.lastErrorTimeLock.Unlock()
|
||||
d := time.Since(r.lastErrorTime)
|
||||
if d < r.minPeriod && d >= 0 {
|
||||
if d < r.minPeriod {
|
||||
// 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()
|
||||
@ -161,3 +164,10 @@ func RecoverFromPanic(err *error) {
|
||||
callers)
|
||||
}
|
||||
}
|
||||
|
||||
// Must panics on non-nil errors. Useful to handling programmer level errors.
|
||||
func Must(err error) {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user