retry

package module
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2018 License: MIT Imports: 2 Imported by: 1 module, 1 package

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.

README

retry

Build Status Coverage Status MIT License GoDoc

Description

retry N times

It is golang porting of perl's Sub::Retry

Synopsis

err := retry.Retry(3, 1*time.Second, func() error {
    // return error once in a while
})
if err != nil {
    // error handling
}

Author

Songmu

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Retry

func Retry(n uint, interval time.Duration, fn func() error) (err error)

Retry calls the `fn` and if it returns the error, retry to call `fn` after `interval` duration. The `fn` is called up to `n` times.

func WithContext added in v0.1.0

func WithContext(ctx context.Context, n uint, interval time.Duration, fn func() error) (err error)

WithContext stops retrying when the context is done.

Types

This section is empty.

Directories

Path Synopsis
cmd
retry command

Jump to

Keyboard shortcuts

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