backoff

package
v3.0.0-...-3edb00a Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2024 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backoff

type Backoff interface {
	Next(err error) bool
	Reset()
}

Backoff used for retry sleep backoff

type ConstantBackoff

type ConstantBackoff struct {
	Sleep time.Duration
	Max   int
	// contains filtered or unexported fields
}

ConstantBackoff implements Backoff interface with constant sleep time. If the error is retryable and with `RetryAfter` defined, the `RetryAfter` will be used as sleep duration.

func (*ConstantBackoff) Next

func (c *ConstantBackoff) Next(err error) bool

func (*ConstantBackoff) Reset

func (c *ConstantBackoff) Reset()

type RetryableError

type RetryableError struct {
	Err        error
	RetryAfter time.Duration
}

func NewRetryableErrorFromHeader

func NewRetryableErrorFromHeader(err error, header http.Header) *RetryableError

NewRetryableErrorFromHeader constructs a new RetryableError from http response header and existing error.

func (*RetryableError) Error

func (e *RetryableError) Error() string

Jump to

Keyboard shortcuts

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