Skip to content

krhubert/backoff

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PkgGoDev

Backoff

This package provides a retry mechanism for functions.

The API is very minimalistic, yet gives options for customization.

Usage

package main

import (
    "fmt"
    "time"

    "github.com/krhubert/backoff"
)

func fn() (string, error) {
    return "out", nil
}

func main() {
    out, err := backoff.Retry2(context.Background(), fn)
    if err != nil {
        fmt.Fprint(os.Stderr, "Failed", err)
        os.Exit(1)
    }
    fmt.Println(out)
}

About

Backoff policy for function retry

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages