https://github.com/squat/retry
A utility library for retrying operations
https://github.com/squat/retry
Last synced: about 1 year ago
JSON representation
A utility library for retrying operations
- Host: GitHub
- URL: https://github.com/squat/retry
- Owner: squat
- License: mit
- Created: 2017-09-07T00:44:07.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2017-09-07T06:03:40.000Z (almost 9 years ago)
- Last Synced: 2025-02-08T16:44:33.963Z (over 1 year ago)
- Language: Go
- Size: 3.91 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Retry
[](https://travis-ci.org/squat/retry)
[](https://goreportcard.com/report/github.com/squat/retry)
[](https://godoc.org/github.com/squat/retry)
## Usage
```go
b := ConstantBackOff{5 * time.Second}
operation := func() error {
// ... do some work
return nil
}
r := NewRetrier(operation, b)
r.Notify(func(m Message) {
if m.Error != nil {
fmt.Println(m.Error)
}
})
// Wait until the operation is done.
r.Done()
fmt.Println("All done!")
```