failover

package
v1.0.4 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2024 License: MIT Imports: 2 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Retryer

type Retryer struct {
	// contains filtered or unexported fields
}

Retryer 重试器

func Retry

func Retry(f func(retryTimes int) error, max int) *Retryer

Retry 自动重试函数

func (*Retryer) Failed

func (r *Retryer) Failed(failedFunc func(err error)) *Retryer

Failed 注册执行失败后置函数(重试最大次数后,仍然失败才调用)

func (*Retryer) Finished

func (r *Retryer) Finished(finishFunc func(retryTimes int, err error) bool) *Retryer

Finished 注册无论成功失败,最终执行完毕后执行的后置函数

func (*Retryer) Run

func (r *Retryer) Run() (int, error)

Run 同步的方式运行

func (*Retryer) RunAsync

func (r *Retryer) RunAsync() <-chan struct{}

RunAsync 异步方式运行

func (*Retryer) Success

func (r *Retryer) Success(successFunc func(retryTimes int)) *Retryer

Success 注册执行成功后置函数

Jump to

Keyboard shortcuts

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