Documentation ¶
Index ¶
- type Backoff
- func NewBackoff(fn func(context.Context, *BackoffOptions) time.Duration) Backoff
- func NewExponentialBackoff(wait time.Duration, baseNumber int64) Backoff
- func NewFixedBackoff(wait time.Duration) Backoff
- func NewLimitedBackoff(base Backoff, min, max time.Duration) Backoff
- func NewRandomizedBackoff(base Backoff, minification, magnification rational.Rational) Backoff
- type BackoffOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Backoff ¶
type Backoff interface { // Time 获取重试的退避时长间隔 Time(context.Context, *BackoffOptions) time.Duration }
Backoff 退避器接口
func NewBackoff ¶
NewBackoff 创建自定义时长的退避器
func NewExponentialBackoff ¶
NewExponentialBackoff 创建时长指数级增长的退避器
func NewLimitedBackoff ¶
NewLimitedBackoff 创建限制时长的退避器
type BackoffOptions ¶
type BackoffOptions struct { // Attempts 重试次数 Attempts int }
BackoffOptions 退避器选项
Click to show internal directories.
Click to hide internal directories.