fix issue #89/#94: retrier called even with 0 retry count and time sleep will be called even when the retries are exhausted
Cancel the retry sleep if the request context is canceled or the deadline exceeded
some proposal:
an interface or option through which we can customize the retry policy (check error check resp.StatusCode)
some times, we need to know the number of retries and responses when the retrier called. Is any idea about this?
I implemented a version using the existing method, but it was not very good get the retry times
type Plugin interface {
OnRequestStart(*http.Request)
OnRequestEnd(*http.Request, *http.Response)
// the response struct contains the request. add a attempt num when the err handler?
OnError(*http.Response, error, int)
}
some proposal: