godo icon indicating copy to clipboard operation
godo copied to clipboard

Retry requests

Open timdp opened this issue 6 years ago • 4 comments

Per #42, I can definitely see how you wouldn't want to retry every failing request. However, it would be good to have the option to do so.

In our case, the DO Terraform provider is choking on the intermittent 503s from the API, and aborting our entire deployment (in which DO is just one of the pieces) as a result.

It'd be great if the Terraform provider would retry a few times where it makes sense--i.e., definitely on reads, and maybe even on writes because the 503 response just means that the request didn't go through anyway. And if you're going to have that retry logic anyway, it's probably better to have it in the core SDK than to repeat it in everything that uses it.

Of course, ultimately, we don't want to get spurious 503 responses at all.

timdp avatar Aug 20 '18 10:08 timdp

This has come up again in https://github.com/terraform-providers/terraform-provider-digitalocean/issues/235. Think we need to implement this here to support Terraform properly.

eddiezane avatar May 16 '19 00:05 eddiezane

Nice, a retry with exponential backoff would be great. I've used https://github.com/cenkalti/backoff in the past, it would fairly trivial to implement.

ojongerius avatar May 16 '19 01:05 ojongerius

And it's causing issues for us again.

bberenberg avatar Jun 18 '19 21:06 bberenberg

We're coming up on a fairly comprehensive review of godo. We'll look at introducing retries then.

hilary avatar Dec 18 '19 16:12 hilary

godo has supported retries with exponential backoff for requests that fail 429 or 500-level response codes for some time now. Starting with the v1.103.0 release, this behavior is enabled by default when the client is initialized using NewFromToken(). If you need more control, a RetryConfig can be used with the New method. For more details, see: https://github.com/digitalocean/godo?tab=readme-ov-file#automatic-retries-and-exponential-backoff

andrewsomething avatar Feb 12 '24 21:02 andrewsomething