Simple Golang Retry Function
May 29, 2017
Adding retry policies in your software is an easy way to increase resiliency. This is especially useful when making HTTP requests or doing anything else that has to reach out across the network. If at first you don’t succeed, try, try again. In go code, that translates to: func retry(attempts int, sleep time.Duration, fn func() error) error { if err := fn(); err != nil { if s, ok := err. ...