Open tooolbox opened 4 years ago
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.
Bumping, any updates on this ?
There's an implementation similar to what @GarryGaller proposed here: https://github.com/gojek/heimdall/pull/105
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.