failover

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 27, 2023 License: MIT Imports: 2 Imported by: 0

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