retry

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2025 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Policy

type Policy struct {
	MaxAttempts int
	Backoff     time.Duration
	Multiplier  float64
	MaxBackoff  time.Duration
	Jitter      time.Duration
	// contains filtered or unexported fields
}

func (*Policy) NoJitter

func (p *Policy) NoJitter() *Policy

func (*Policy) Run

func (p *Policy) Run(fn func(attempt int) (err error, fatal error)) error

Run executes fn using retry policy p. Stops retrying on success or after p.Attempts retries. In case fn returns fatal error, Run exits immediately. Note: use `policy.NoJitter().Run(...)` to eliminate jitter. Simple `policy := Policy{Jitter: 0}; policy.Run(...)` will result in default jitter.

Jump to

Keyboard shortcuts

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