Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/cenkalti/backoff
/ functions
Functions
85 in github.com/cenkalti/backoff
⨍
Functions
85
◇
Types & classes
18
↓ 20 callers
Function
Retry
Retry attempts the operation until it succeeds, returns a Permanent error, or backoff completes. It ensures the operation is executed at least once.
retry.go:114
↓ 19 callers
Function
withTimer
withTimer sets a custom timer for managing delays between retries.
retry.go:48
↓ 16 callers
Method
Is
Is reports a match against ErrPermanent so a Permanent error can be detected with errors.Is even before Retry converts it into a RetryError.
error.go:100
↓ 13 callers
Function
WithBackOff
WithBackOff configures the backoff policy used between attempts. The default is NewExponentialBackOff. Retry calls Reset on the policy before the fir
retry.go:41
↓ 11 callers
Method
Error
Error returns the wrapped error's message.
error.go:93
↓ 8 callers
Function
NewExponentialBackOff
NewExponentialBackOff creates an instance of ExponentialBackOff using default values.
exponential.go:66
↓ 7 callers
Function
WithMaxElapsedTime
WithMaxElapsedTime limits the total wall-clock time spent retrying, measured from when Retry is called. When the limit is reached, Retry returns a *Re
retry.go:94
↓ 6 callers
Function
AsRetryError
AsRetryError returns the *RetryError in err's chain, or nil if there is none (including when err is nil). It is a convenience wrapper around errors.As
error.go:69
↓ 6 callers
Function
NewConstantBackOff
(d time.Duration)
backoff.go:68
↓ 6 callers
Function
RetryAfter
RetryAfter returns a RetryAfterError that tells Retry to wait the given duration before the next attempt. cause is the error that triggered the wait;
error.go:125
↓ 6 callers
Function
WithMaxTries
WithMaxTries limits the total number of attempts, not retries: WithMaxTries(1) runs the operation once and does not retry. When the limit is reached,
retry.go:65
↓ 5 callers
Function
Permanent
Permanent wraps err to signal that Retry should stop immediately instead of retrying. Retry then returns a *RetryError with Cause ErrPermanent and Las
error.go:85
↓ 4 callers
Method
Stop
Stop turns off a ticker. After Stop, no more ticks will be sent.
ticker.go:42
↓ 4 callers
Method
Stop
()
timer.go:7
↓ 3 callers
Function
NewTicker
NewTicker returns a new Ticker containing a channel that will send the time at times specified by the BackOff argument. Ticker is guaranteed to tick a
ticker.go:27
↓ 3 callers
Method
NextBackOff
NextBackOff calculates the next backoff interval using the formula: Randomized interval = RetryInterval * (1 ± RandomizationFactor)
exponential.go:84
↓ 3 callers
Method
NextBackOff
NextBackOff returns the duration to wait before retrying the operation, backoff.Stop to indicate that no more retries should be made. Example usage:
backoff.go:33
↓ 3 callers
Method
Reset
Reset the interval back to the initial retry interval and restarts the timer. Reset must be called before using b.
exponential.go:77
↓ 3 callers
Method
Reset
Reset to initial state.
backoff.go:36
↓ 3 callers
Method
Unwrap
Unwrap returns the wrapped error.
error.go:96
↓ 3 callers
Function
assertEquals
(t *testing.T, expected, value time.Duration)
exponential_test.go:85
↓ 2 callers
Method
C
()
timer.go:8
↓ 2 callers
Method
Start
(duration time.Duration)
timer.go:6
↓ 2 callers
Function
getRandomValueFromInterval
Returns a random value from the following interval: [currentInterval - randomizationFactor * currentInterval, currentInterval + randomizationFactor
exponential.go:107
↓ 1 callers
Method
Error
Error returns a single-line representation of the cause and last error.
error.go:57
↓ 1 callers
Method
Error
Error returns a string representation of the RetryAfter error.
error.go:133
↓ 1 callers
Method
NextBackOff
()
backoff.go:66
↓ 1 callers
Function
WithNotify
WithNotify sets a function called after each failed attempt that will be retried. See Notify for exactly when it fires.
retry.go:56
↓ 1 callers
Method
incrementCurrentInterval
Increments the current interval by multiplying it with the multiplier.
exponential.go:95
↓ 1 callers
Method
run
()
ticker.go:46
↓ 1 callers
Method
send
(tick time.Time)
ticker.go:68
↓ 1 callers
Function
subtestNextBackOff
(t *testing.T, expectedValue time.Duration, backOffPolicy BackOff)
backoff_test.go:13
Method
C
()
retry_test.go:28
Method
C
()
retry_test.go:381
Method
C
C returns the timers channel which receives the current time when the timer fires.
timer.go:17
Function
ExampleRetry
()
example_test.go:16
Function
ExampleRetry_outcomes
()
example_test.go:67
Function
ExampleTicker
()
example_test.go:119
Method
NextBackOff
()
retry_test.go:388
Method
NextBackOff
()
backoff.go:48
Method
NextBackOff
()
backoff.go:56
Method
Reset
()
retry_test.go:386
Method
Reset
()
backoff.go:46
Method
Reset
()
backoff.go:54
Method
Reset
()
backoff.go:65
Method
Start
(duration time.Duration)
retry_test.go:18
Method
Start
(d time.Duration)
retry_test.go:370
Method
Start
Start starts the timer to fire after the given duration
timer.go:22
Method
Stop
()
retry_test.go:22
Method
Stop
()
retry_test.go:375
Method
Stop
Stop is called when the timer is not used anymore and resources may be freed.
timer.go:31
Function
TestBackOff
(t *testing.T)
exponential_test.go:9
Function
TestBackOffOverflow
(t *testing.T)
exponential_test.go:53
Function
TestBackOffRandomizedOverflow
(t *testing.T)
exponential_test.go:71
Function
TestConstantBackOff
(t *testing.T)
backoff_test.go:22
Function
TestGetRandomizedInterval
(t *testing.T)
exponential_test.go:41
Function
TestIssue177
Permanent error bubbles up when WithMaxTries(1) https://github.com/cenkalti/backoff/issues/177
retry_test.go:348
Function
TestNextBackOffMillis
(t *testing.T)
backoff_test.go:8
Function
TestPermanent
(t *testing.T)
retry_test.go:287
Function
TestRetry
(t *testing.T)
retry_test.go:32
Function
TestRetryAfter
(t *testing.T)
retry_test.go:480
Function
TestRetryAfterCarriesError
https://github.com/cenkalti/backoff/issues/184
retry_test.go:592
Function
TestRetryAfterError
(t *testing.T)
retry_test.go:563
Function
TestRetryAfterNegativeDuration
(t *testing.T)
retry_test.go:680
Function
TestRetryAfterNegativeDurationWaitsZero
(t *testing.T)
retry_test.go:700
Function
TestRetryAfterPolicyStop
(t *testing.T)
retry_test.go:512
Function
TestRetryAfterTypedNil
(t *testing.T)
retry_test.go:538
Function
TestRetryContext
(t *testing.T)
retry_test.go:89
Function
TestRetryContextDeadline
(t *testing.T)
retry_test.go:393
Function
TestRetryContextErrorIncludesOperationError
https://github.com/cenkalti/backoff/issues/181
retry_test.go:126
Function
TestRetryElapsedTimeOverflow
(t *testing.T)
retry_test.go:644
Function
TestRetryError
(t *testing.T)
retry_test.go:169
Function
TestRetryErrorString
(t *testing.T)
retry_test.go:629
Function
TestRetryMaxElapsedTimeErrorIncludesOperationError
https://github.com/cenkalti/backoff/issues/181
retry_test.go:152
Function
TestRetryMaxTriesCount
(t *testing.T)
tries_test.go:9
Function
TestRetryMaxTriesUnlimited
(t *testing.T)
tries_test.go:34
Function
TestRetryNotify
(t *testing.T)
retry_test.go:413
Function
TestRetryPermanent
(t *testing.T)
retry_test.go:213
Function
TestRetryPermanentError
(t *testing.T)
retry_test.go:319
Function
TestRetryWithData
(t *testing.T)
retry_test.go:59
Function
TestTicker
(t *testing.T)
ticker_test.go:10
Function
TestTickerStop
(t *testing.T)
ticker_test.go:49
Function
TestTickerStopsOnBackOffStop
(t *testing.T)
ticker_test.go:60
Method
Unwrap
Unwrap returns the cause and the last operation error so both can be matched with errors.Is and errors.As.
error.go:63
Method
Unwrap
Unwrap returns the error that triggered the retry, if one was provided.
error.go:141