Open rew1nter opened 2 years ago
You need to override the https://github.com/hashicorp/go-retryablehttp/blob/master/client.go#L343-L351= using https://github.com/hashicorp/go-retryablehttp/blob/master/client.go#L404=
client := retryablehttp.NewClient()
client.CheckRetry = (ctx context.Context, resp *http.Response, err error) (bool, error) {
// do not retry on context.Canceled or context.DeadlineExceeded
if ctx.Err() != nil {
return false, ctx.Err()
}
// Do your retry logic here...
return retryablehttp.DefaultRetryPolicy(ctx, resp, err)
}
For example, I wanna catch
TCP dial Temporary failure in resolution
error which is thrown by client.Do() and then retry