retry

package
v1.9.1 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package retry contains utilities for performing retries when functions return errors.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Do

func Do(ctx context.Context, max int, fn func(ctx context.Context) error) error

Do performs an action with a maximum number of retries. If fn returns a non-nil error, it will be retried up to the maximum number of times and then returned. If fn returns a nil error, the retry loop is broken. The loop is also broken if the provided context is cancelled. Returning an error wrapped with the Stop function will prevent further retries from occurring.

func Stop added in v1.3.0

func Stop(err error) error

Stop wraps err so that when it is returned to the retry mechanism no further retries are attempted.

Types

This section is empty.

Jump to

Keyboard shortcuts

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