Documentation ¶
Overview ¶
Package retry implements simple retry functionality.
For example to retry an HTTP request:
func Do(client *http.Client, req *http.Request) (rsp *http.Response, err error) { retry.Retry( retry.Count(5), retry.Backoff(time.Second, time.Second*30), func(i int) bool { if 0 < i { req.Body, err = req.GetBody() if nil != err { return false } } rsp, err = client.Do(req) if nil != err { return false } if 500 <= rsp.StatusCode && nil != req.GetBody { rsp.Body.Close() return true } return false }) return }
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.