executor

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Retry

func Retry(max int, timeout time.Duration, b interfaces.Balancer) endpoint.Endpoint

重试执行器,拥有最大重试次数

func RetryAlways

func RetryAlways(timeout time.Duration, b interfaces.Balancer) endpoint.Endpoint

重试执行器,会一直重试直到成功

func RetryWithCallback

func RetryWithCallback(timeout time.Duration, b interfaces.Balancer, cb RetryCallback) endpoint.Endpoint

Types

type RetryCallback

type RetryCallback func(n int, received error) (keepTrying bool, replacement error)

重试执行器回调函数接口,返回是否重试

type RetryError

type RetryError struct {
	RawErrors []error
	Final     error // 最终结果,如果成功值为 nil
}

用于保存多次重试错误

func (RetryError) Error

func (e RetryError) Error() string

Jump to

Keyboard shortcuts

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