ecretryablehttp

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2023 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultRetryWaitMinSeconds = 1
	DefaultRetryWaitMaxSeconds = 60
	DefaultRetryMax            = 5
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CheckRetry

type CheckRetry func(
	ctx context.Context,
	resp *http.Response,
	err error,
) (bool, error)

type RetryConfig

type RetryConfig struct {
	// Logger -
	Logger eclog.Logger

	// The minimum wait time for retries on API errors
	RetryWaitMin *time.Duration

	// The maximum wait time for retries on API errors
	RetryWaitMax *time.Duration

	// The maximum number of retries on API errors
	RetryMax *int

	// CheckRetry is a handler that allows users to define custom logic
	// to determine whether the API Client should retry a failed API call
	CheckRetry CheckRetry
}

type RetryableHTTPClientAdapter

type RetryableHTTPClientAdapter struct {
	RetryableHttpClient *retryablehttp.Client
	HasCustomRetry      bool
}

Adapts the client from the retryablehttp library

func NewRetryableHTTPClientAdapter

func NewRetryableHTTPClientAdapter(
	config RetryConfig,
) *RetryableHTTPClientAdapter

func (*RetryableHTTPClientAdapter) Do

func (c *RetryableHTTPClientAdapter) Do(
	method string,
	url *url.URL,
	headers map[string]string,
	rawBody interface{},
) (*http.Response, error)

Jump to

Keyboard shortcuts

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