retry

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultRetryCount = 3               // 默认的超时重试次数
	DefaultGapTime    = 3 * time.Second // 默认的超时时间间隔
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DelayRetryFunc

type DelayRetryFunc func(context.Context, interface{}) (interface{}, bool, error)

type RetryOption

type RetryOption struct {
	GapTime    time.Duration  // 重试间隔时间
	RetryCount int            // 重试次数
	RetryFunc  DelayRetryFunc // 重试函数
	// contains filtered or unexported fields
}

func NewRetryOption

func NewRetryOption(ctx context.Context, gapTime time.Duration, retryCount int, func_ DelayRetryFunc) *RetryOption

func (*RetryOption) Retry

func (r *RetryOption) Retry(ctx context.Context, req interface{}) (resp interface{}, err error)

Jump to

Keyboard shortcuts

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