Documentation
¶
Overview ¶
Package retry provides utilities for performing operations with retry logic. It wraps the cenkalti/backoff library to support exponential backoff strategies with context cancellation.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ExponentialBackoff ¶
type ExponentialBackoff struct {
// contains filtered or unexported fields
}
ExponentialBackoff configures and executes operations using an exponential backoff strategy.
func NewExponentialBackoff ¶
func NewExponentialBackoff(maxElapsedTime time.Duration) ExponentialBackoff
NewExponentialBackoff creates a new ExponentialBackoff instance with the specified maximum elapsed time limit.
func (ExponentialBackoff) Do ¶
func (e ExponentialBackoff) Do(ctx context.Context, operation func() error) error
Do executes the provided operation, retrying it on failure using exponential backoff. The function returns when the operation succeeds, the context is cancelled, or the maxElapsedTime limit is reached. Returns the last error if all attempts fail.