backoff

package
v1.16.18 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2023 License: AGPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Backoff

type Backoff struct {
	Content func() error
	// contains filtered or unexported fields
}

Backoff 错误重试 积分退避算法

func New

func New(c Conf) Backoff

func (Backoff) AddCron

func (a Backoff) AddCron(c *cron.Cron, spec string) (cron.EntryID, error)

func (Backoff) Start

func (a Backoff) Start()

func (Backoff) Worker

func (a Backoff) Worker()

Worker 请注意,此处使用的是普通接收器,当 worker 重新运行时 retry 会被重置

type Conf

type Conf struct {
	Content func() error
	// 最大重试等待时间
	MaxRetryDelay time.Duration
}

Jump to

Keyboard shortcuts

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