retry

package
v0.22.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 13, 2026 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Sleep

func Sleep(ctx context.Context, d time.Duration) error

Sleep is the equivalent of gax.Sleep without the need for the dependency.

Types

type Options added in v0.21.0

type Options struct {
	// Initial is the initial backoff duration.
	Initial time.Duration
	// Max is the maximum backoff duration for a single retry attempt.
	// It does not limit the total time of all retries.
	Max time.Duration
	// Multiplier is the factor by which the backoff duration is multiplied after each attempt.
	Multiplier float64
	// MaxAttempts is the maximum number of attempts before giving up.
	MaxAttempts int
}

Options defines the configuration for the Retryer.

type Retryer

type Retryer struct {
	// contains filtered or unexported fields
}

Retryer handles retry logic for HTTP requests using a configurable backoff strategy.

func New

func New() *Retryer

New returns a new Retryer with the default backoff strategy.

func NewWithOptions added in v0.21.0

func NewWithOptions(opts *Options) *Retryer

NewWithOptions returns a new Retryer with the specified backoff strategy. If any option is not set (zero value), it defaults to the values used in New().

func (*Retryer) Retry

func (r *Retryer) Retry(status int, err error) (time.Duration, bool)

Retry determines if a request should be retried.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL