retry

package
v0.1.6 Latest Latest
Warning

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

Go to latest
Published: Jan 7, 2025 License: AGPL-3.0 Imports: 3 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package retry provides a simple interface for retrying operations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Doer

type Doer interface {
	// Do performs an operation.
	//
	// It should return an error that can be checked for retriability.
	Do(ctx context.Context) error
}

Doer does something and returns an error.

type IntervalRetrier

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

IntervalRetrier retries a call with an interval. The call is defined in the Doer property.

func NewIntervalRetrier

func NewIntervalRetrier(doer Doer, interval time.Duration, retriable func(error) bool, optClock ...clock.WithTicker) *IntervalRetrier

NewIntervalRetrier returns a new IntervalRetrier. The optional clock is used for testing.

func (*IntervalRetrier) Do

func (r *IntervalRetrier) Do(ctx context.Context) error

Do retries performing a call until it succeeds, returns a permanent error or the context is cancelled.

Jump to

Keyboard shortcuts

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