httputil

package
v3.44.2 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2022 License: Apache-2.0 Imports: 5 Imported by: 3

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DoWithRetry

func DoWithRetry(req *http.Request, client *http.Client) (*http.Response, error)

DoWithRetry calls client.Do, and in the case of an error, retries the operation again after a slight delay. Uses the default retry delays, starting at 100ms and ramping up to ~1.3s.

func DoWithRetryOpts added in v3.20.0

func DoWithRetryOpts(req *http.Request, client *http.Client, opts RetryOpts) (*http.Response, error)

DoWithRetryOpts calls client.Do, but retrying 500s (even for POSTs). Using the provided delays.

func GetWithRetry

func GetWithRetry(url string, client *http.Client) (*http.Response, error)

GetWithRetry issues a GET request with the given client, and in the case of an error, retries the operation again after a slight delay.

Types

type RetryOpts added in v3.20.0

type RetryOpts struct {
	// These fields map directly to util.Acceptor.
	Delay    *time.Duration
	Backoff  *float64
	MaxDelay *time.Duration

	MaxRetryCount *int
}

RetryOpts defines options to configure the retry behavior. Leave nil for defaults.

Jump to

Keyboard shortcuts

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