retry

package
v0.0.0-...-e38a99a Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2022 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Retry

type Retry interface {
	// Do execute work first, if execute failed, retry execute many times
	Do(f func() error, desc string) wait.Wait
	// DoWithContext execute work first, if execute failed, retry execute many times, cancel retry with context
	DoWithContext(ctx context.Context, f func() error, desc string) wait.Wait
	// Count the retry count
	Count() int
	// WaitTime the wait time after every retry to fail
	WaitTime() time.Duration
}

Retry if execute return error, then retry to execute with the specified rule

func New

func New(count int, wait time.Duration, async bool) Retry

New get a default retry instance count the retry execute count wait execute once per wait interval async is async or sync to execute retry

Jump to

Keyboard shortcuts

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