Skip to content

ffigiel/retry-go

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

9 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

retry-go GoDoc

πŸ” Minimal retry library for Go

Usage

Basic example:

var res *http.Response
var err error
for r := retry.Exp(5, time.Second); r.Next(err); {
  res, err = http.Get("https://example.com")
}
if err != nil {
  // ...
}

Reusable retryer with custom DurationFunc

var retryF = retry.Factory(3, func (i time.Duration) time.Duration {
  return 15 * i * time.Second
})

var res *http.Response
var err error
for r := retryF(); r.Next(err); {
  res, err = http.Get("https://example.com")
}
if err != nil {
  // ...
}

Changelog

v0.1.0

Initial release