retrier

package
v7.25.2 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrMaliciousResponse = errors.New("malicious response")

Functions

func IsErrorRetryable

func IsErrorRetryable(err error) bool

func IsStatusCodeRetryable

func IsStatusCodeRetryable(statusCode int) bool

Types

type Retrier

type Retrier interface {
	// Retry 判断是否重试,如何重试
	Retry(*http.Response, error, *RetrierOptions) RetryDecision
}

Retrier 重试器接口

func NewErrorRetrier

func NewErrorRetrier() Retrier

NewErrorRetrier 创建错误重试器,为七牛默认的错误重试器

func NewNeverRetrier

func NewNeverRetrier() Retrier

NewNeverRetrier 创建从不重试的重试器

func NewRetrier

func NewRetrier(fn func(*http.Response, error, *RetrierOptions) RetryDecision) Retrier

NewRetrier 创建自定义重试器

type RetrierOptions

type RetrierOptions backoff.BackoffOptions

RetrierOptions 重试器选项

type RetryDecision

type RetryDecision int

RetryDecision 重试决策

const (
	// 不再重试
	DontRetry RetryDecision = iota

	// 重试下一个域名
	TryNextHost

	// 重试当前域名
	RetryRequest
)

Jump to

Keyboard shortcuts

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