Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Retry ¶
func Retry(retryableFunc RetryableFuncWithResponse, options ...RetryOption) (*http.Response, error)
Retry retries the provided retryableFunc according to the retry configuration options.
Types ¶
type OnRetryFunc ¶
OnRetryFunc is a function type that is called on each retry attempt.
type RetryConfig ¶
type RetryConfig struct {
// contains filtered or unexported fields
}
RetryConfig contains configuration options for the retry mechanism.
type RetryIfFunc ¶
RetryIfFunc determines whether a retry should be attempted based on the error.
type RetryOption ¶
type RetryOption func(*RetryConfig)
RetryOption is a function type for modifying RetryConfig options.
func WithBackoff ¶
func WithBackoff(backoff time.Duration) RetryOption
WithBackoff sets the backoff duration between retries.
func WithMaxJitter ¶
func WithMaxJitter(maxJitter time.Duration) RetryOption
WithMaxJitter sets the maximum jitter duration to add to the backoff.
func WithOnRetry ¶
func WithOnRetry(onRetry OnRetryFunc) RetryOption
WithOnRetry sets the callback function to execute on each retry.
func WithRetries ¶
func WithRetries(retries uint) RetryOption
WithRetries sets the number of retries for the retry configuration.
func WithRetryIf ¶
func WithRetryIf(retryIf RetryIfFunc) RetryOption
WithRetryIf sets the condition to determine whether to retry based on the error.
type RetryableFuncWithResponse ¶
RetryableFuncWithResponse represents a function that returns an HTTP response or an error.