status-go/vendor/github.com/eapache/go-resiliency/retrier
Victor Farazdagi 745c3a46c1 Updates vendors 2016-10-12 01:59:43 +03:00
..
README.md Updates vendors 2016-10-12 01:59:43 +03:00
backoffs.go Updates vendors 2016-10-12 01:59:43 +03:00
classifier.go Updates vendors 2016-10-12 01:59:43 +03:00
retrier.go Updates vendors 2016-10-12 01:59:43 +03:00

README.md

retrier

Build Status GoDoc Code of Conduct

The retriable resiliency pattern for golang.

Creating a retrier takes two parameters:

  • the times to back-off between retries (and implicitly the number of times to retry)
  • the classifier that determines which errors to retry
r := retrier.New(retrier.ConstantBackoff(3, 100*time.Millisecond), nil)

err := r.Run(func() error {
	// do some work
	return nil
})

if err != nil {
	// handle the case where the work failed three times
}