retrier

package
v0.49.0 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExponentialBackoff

func ExponentialBackoff(n int, initialAmount time.Duration) []time.Duration

Types

type Action

type Action int
const (
	Succeed         Action = iota // Succeed indicates the Retrier should treat this value as a success.
	Fail                          // Fail indicates the Retrier should treat this value as a hard failure and not retry.
	Retry                         // Retry indicates the Retrier should treat this value as a soft failure and retry.
	AdditionalCheck               // Additional check is required to determine if it's Fail or Retry
)

type AdditionalTest

type AdditionalTest interface {
	IsHardFailure(context.Context) (bool, error)
}

type Retrier

type Retrier struct {
	// contains filtered or unexported fields
}

func NewRetrier

func NewRetrier(n int, initial time.Duration, at AdditionalTest) *Retrier

func (*Retrier) RunCtx

func (r *Retrier) RunCtx(ctx context.Context, work func(ctx context.Context) (driver.Rows, Action, error)) (driver.Rows, error)

Jump to

Keyboard shortcuts

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