rhttp

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Aug 20, 2024 License: Apache-2.0 Imports: 6 Imported by: 1

Documentation

Index

Constants

View Source
const (
	DefaultPolicy     = "default"
	ExponentialPolicy = "exponential"
	JitterPolicy      = "jitter"
	ConstantPolicy    = "const"
)

policies

Variables

This section is empty.

Functions

func ConstantBackoff

func ConstantBackoff(min, _ time.Duration, _ int, _ *http.Response) time.Duration

Types

type RetryConfig

type RetryConfig struct {
	WaitMin     time.Duration `yaml:"wait_min"`
	WaitMax     time.Duration `yaml:"wait_max"`
	MaxAttempts int           `yaml:"max_attempts"`
	Policy      string        `yaml:"policy,omitempty"`
	// contains filtered or unexported fields
}

func (*RetryConfig) NewClient

func (rc *RetryConfig) NewClient(rt http.RoundTripper, logger interface{}) (*http.Client, error)

NewClient should be called only after Validate has been called, to make sure that rc is a valid RetryConfig

func (*RetryConfig) Validate

func (rc *RetryConfig) Validate() (err error)

Validate must be called once, after rc has been constructed / unmarshalled

Jump to

Keyboard shortcuts

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