Documentation ¶
Index ¶
- type Backoff
- func NewBackoff(strategy BackoffStrategy, start time.Duration, limit time.Duration) *Backoff
- func NewExponential(start time.Duration, limit time.Duration) *Backoff
- func NewExponentialFullJitter(start time.Duration, limit time.Duration) *Backoff
- func NewLinear(start time.Duration, limit time.Duration) *Backoff
- type BackoffStrategy
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backoff ¶
type Backoff struct { // LastDuration contains the duration that was previously waited, or 0 if no backoff has occurred yet. LastDuration time.Duration // NextDuration contains the duration that will be waited on the next call to Backoff(). NextDuration time.Duration // contains filtered or unexported fields }
Backoff tracks the generic state of the configured back off strategy.
func NewBackoff ¶
NewBackoff creates a new Backoff using the specified BackoffStrategy, start duration and limit.
func NewExponential ¶
NewExponential creates a new backoff using the exponential backoff algorithm.
func NewExponentialFullJitter ¶
NewExponentialFullJitter creates a new backoff using the exponential with full jitter backoff algorithm.
type BackoffStrategy ¶
type BackoffStrategy interface { // GetBackoffDuration calculates the next time.Duration that the current thread will sleep for when backing off. // It receives the current backoff count, the initial backoff duration and the last back off duration. GetBackoffDuration(int, time.Duration, time.Duration) time.Duration }
BackoffStrategy can be implemented to provide different backoff algorithms.
Directories ¶
Path | Synopsis |
---|---|
Godeps
|
|
_workspace/src/github.com/stretchr/testify/assert
A set of comprehensive testing tools for use with the normal Go testing system.
|
A set of comprehensive testing tools for use with the normal Go testing system. |
Click to show internal directories.
Click to hide internal directories.