Documentation
¶
Index ¶
- Constants
- Variables
- func GenerateBytesUUID() []byte
- func GenerateUUID() string
- func NewBackoffRetryRunner(maxTimes int, initial, maxDelay time.Duration) *retryRunner
- func NewProbabilisticRetryRunner(maxTimes int, interval int64, expBackoff bool) *retryRunner
- func NewRetryRunner(maxTimes int, delay time.Duration, expBackoff bool) *retryRunner
- func NewTypedRetryRunner[V any](maxTimes int, delay time.Duration, expBackoff bool) *typedRetryRunner[V]
Constants ¶
const Infinitely = -1
Infinitely, passed as maxTimes, makes a runner retry until success or, for RunContext, until the context ends.
Variables ¶
var ErrMaxRetriesExceeded = errors.New("maximum number of retries exceeded")
ErrMaxRetriesExceeded is returned, possibly joined with the last attempt's error, when a runner exhausts its attempts without success.
Functions ¶
func GenerateBytesUUID ¶
func GenerateBytesUUID() []byte
GenerateBytesUUID creates a new random UUID and returns it as []byte
func GenerateUUID ¶
func GenerateUUID() string
GenerateUUID creates a new random UUID and returns it as a string
func NewBackoffRetryRunner ¶ added in v0.26.0
NewBackoffRetryRunner returns a runner with exponential backoff and full jitter: the n-th delay is drawn uniformly from [0, min(initial*2^n, maxDelay)). The randomness on every attempt keeps many nodes from retrying a recovering service in lockstep, and maxDelay bounds the wait. If maxDelay < initial, maxDelay is raised to initial. A non-positive initial retries without waiting.
func NewProbabilisticRetryRunner ¶
NewProbabilisticRetryRunner returns a runner whose first delay is a random value in [1, interval] milliseconds. Later delays follow NewRetryRunner.
func NewRetryRunner ¶
NewRetryRunner returns a runner that waits delay between attempts, doubling it after each attempt if expBackoff is set.
Types ¶
This section is empty.
Directories
¶
| Path | Synopsis |
|---|---|
|
Package buildinfo reports what the Go toolchain embedded in the running binary about the FSC module, the application module and the VCS revision.
|
Package buildinfo reports what the Go toolchain embedded in the running binary about the FSC module, the application module and the VCS revision. |
|
Package compose builds and splits composite keys from object types and attributes.
|
Package compose builds and splits composite keys from object types and attributes. |
|
Package configtest checks the reference configuration in docs/configuration.md against the code that reads it.
|
Package configtest checks the reference configuration in docs/configuration.md against the code that reads it. |
|
Package errors provides helpers for creating, annotating, wrapping, and joining errors, and for inspecting their causes and types.
|
Package errors provides helpers for creating, annotating, wrapping, and joining errors, and for inspecting their causes and types. |
|
Package proto provides Protocol Buffer marshaling, unmarshaling, equality, and cloning helpers.
|
Package proto provides Protocol Buffer marshaling, unmarshaling, equality, and cloning helpers. |