retry

package
v0.0.1-alpha Latest Latest
Warning

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

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

Documentation

Overview

Package retry contains helper methods that create retry loops using different retry strategies.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExponentialBackoff

type ExponentialBackoff struct {
	Factor        int
	MaxInterval   time.Duration
	MaxRetries    int
	MaxErrorMsg   string
	MaxErrorKey   string
	MaxErrorValue string
}

ExponentialBackoff options.

func (ExponentialBackoff) Retry

func (eb ExponentialBackoff) Retry(fn func() error)

func (ExponentialBackoff) RetryUntilSuccessful

func (eb ExponentialBackoff) RetryUntilSuccessful(action func() error)

RetryUntilSuccessful creates a retry loop with an exponential backoff.

func (ExponentialBackoff) RetryWithBackOff

func (eb ExponentialBackoff) RetryWithBackOff(fn func() error) error

type Strategy

type Strategy interface {
	RetryUntilSuccessful(func() error)
	RetryWithBackOff(func() error)
	RetryOnce(func() error)
}

Strategy interface type contains methods for different retry strategies.

Jump to

Keyboard shortcuts

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