Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retry Based on Response Code #87

Open
tooolbox opened this issue Jul 14, 2020 · 2 comments
Open

Retry Based on Response Code #87

tooolbox opened this issue Jul 14, 2020 · 2 comments

Comments

@tooolbox
Copy link

Currently looks like the retry mechanism will only engage if there's an actual error in sending the request, or if it's a 5xx response code.

It would be handy to be able to configure it so that it will retry on a non-2xx response code. I can do a PR if the maintainers are interested.

@GarryGaller
Copy link

GarryGaller commented Aug 7, 2020

A good idea. I just wanted to ask the package developer to do this.
Add a statusForRetry field of type [] int to the Client structure,
and replace the if response.StatusCode >= http.StatusInternalServerError condition by checking whether http code is included in statusForRetry. Better still, make a map where the key is the http status, and the value is a structure with the timeout, retryCount, and callback function fields.

@arieltorti
Copy link

Bumping, any updates on this ?

There's an implementation similar to what @GarryGaller proposed here: #105

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants