backoff

package
v0.0.6 Latest Latest
Warning

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

Go to latest
Published: Jan 22, 2025 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExpBackoff

type ExpBackoff struct {
	Delay    time.Duration // 延迟时间
	MaxDelay time.Duration // 最大延迟时间
	// contains filtered or unexported fields
}

ExpBackoff 指数退避算法结构体

func (*ExpBackoff) Run

func (b *ExpBackoff) Run(f func() error) (err error, ran bool)

Run 执行给定的函数,并根据执行结果更新退避状态 参数:

  • f func() error: 需要执行的函数

返回值:

  • err error: 执行函数返回的错误
  • ran bool: 是否实际执行了函数

Jump to

Keyboard shortcuts

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