retry-go
Retrying made simple and easy for golang
About retry-go
retry-go
- Retrying made simple and easy for golang.
Installation
go get -u github.com/rafaeljesus/retry-go
Usage
Do
package main
import (
"time"
"github.com/rafaeljesus/retry-go"
)
func main() {
attempts := 3
sleepTime := time.Second*2
if err := retry.Do(func() error {
return work()
}, attempts, sleepTime); err != nil {
// Retry failed
}
}
DoHTTP
package main
import (
"time"
"github.com/rafaeljesus/retry-go"
)
func main() {
attempts := 3
sleepTime := time.Second*2
if err := retry.DoHTTP(func() (*http.Response, error) {
return makeRequest()
}, attempts, sleepTime); err != nil {
// Retry failed
}
}
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create new Pull Request
Badges
GitHub @rafaeljesus · Medium @_jesus_rafael · Twitter @_jesus_rafael
Frequently Asked Questions
What is retry-go?
retry-go is a Utilities library for the Go programming language. Retrying made simple and easy for golang
How do I install retry-go?
Install retry-go with the Go module system using `go get rafaeljesus/retry-go`. Check the repository for the current installation instructions.
What category does retry-go belong to?
retry-go is listed under Utilities, specifically Utilities.