Documentation
¶
Index ¶
- func BackoffUntil(f func() (bool, error), backoff BackoffManager, sliding bool, ...)
- func Jitter(duration time.Duration, maxFactor float64) time.Duration
- func MergeAndCloseOnAnyStopChannel[T any](upstreams ...<-chan T) <-chan T
- func Until(f func(), period time.Duration, stopCh <-chan struct{})
- type BackoffFunc
- type BackoffManager
- type FastBackoffOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BackoffUntil ¶
func BackoffUntil(f func() (bool, error), backoff BackoffManager, sliding bool, stopCh <-chan struct{})
func Jitter ¶
Jitter returns a time.Duration between duration and duration + maxFactor * duration.
This allows clients to avoid converging on periodic behavior. If maxFactor is 0.0, a suggested default value will be chosen.
func MergeAndCloseOnAnyStopChannel ¶
func MergeAndCloseOnAnyStopChannel[T any](upstreams ...<-chan T) <-chan T
Types ¶
type BackoffFunc ¶
type BackoffManager ¶
type BackoffManager interface {
Backoff(previousDuration time.Duration, previousConditionError bool) time.Duration
}
func NewFastBackoffManager ¶
func NewFastBackoffManager(options FastBackoffOptions) BackoffManager
type FastBackoffOptions ¶
type FastBackoffOptions struct {
Duration time.Duration
Factor float64
Jitter float64
MaxDuration time.Duration
InitDurationIfFail time.Duration
// If FastRetryCount > 0, then within the FastRetryWindow time window,
// the retry will be performed with a delay of FastRetryDelay for the first FastRetryCount calls.
FastRetryCount int
FastRetryDelay time.Duration
FastRetryJitter float64
FastRetryWindow time.Duration
}
Click to show internal directories.
Click to hide internal directories.