mirror of https://github.com/k3s-io/k3s
util/goroutinemap code cleanup
parent
9d33926d5c
commit
d771963a5e
|
@ -24,27 +24,12 @@ package goroutinemap
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"sync"
|
"sync"
|
||||||
"time"
|
|
||||||
|
|
||||||
"github.com/golang/glog"
|
"github.com/golang/glog"
|
||||||
k8sRuntime "k8s.io/apimachinery/pkg/util/runtime"
|
k8sRuntime "k8s.io/apimachinery/pkg/util/runtime"
|
||||||
"k8s.io/kubernetes/pkg/util/goroutinemap/exponentialbackoff"
|
"k8s.io/kubernetes/pkg/util/goroutinemap/exponentialbackoff"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
|
||||||
// initialDurationBeforeRetry is the amount of time after an error occurs
|
|
||||||
// that GoRoutineMap will refuse to allow another operation to start with
|
|
||||||
// the same operation name (if exponentialBackOffOnError is enabled). Each
|
|
||||||
// successive error results in a wait 2x times the previous.
|
|
||||||
initialDurationBeforeRetry = 500 * time.Millisecond
|
|
||||||
|
|
||||||
// maxDurationBeforeRetry is the maximum amount of time that
|
|
||||||
// durationBeforeRetry will grow to due to exponential backoff.
|
|
||||||
// Value is slightly offset from 2 minutes to make timeouts due to this
|
|
||||||
// constant recognizable.
|
|
||||||
maxDurationBeforeRetry = 2*time.Minute + 1*time.Second
|
|
||||||
)
|
|
||||||
|
|
||||||
// GoRoutineMap defines a type that can run named goroutines and track their
|
// GoRoutineMap defines a type that can run named goroutines and track their
|
||||||
// state. It prevents the creation of multiple goroutines with the same name
|
// state. It prevents the creation of multiple goroutines with the same name
|
||||||
// and may prevent recreation of a goroutine until after the a backoff time
|
// and may prevent recreation of a goroutine until after the a backoff time
|
||||||
|
|
Loading…
Reference in New Issue