godo
godo copied to clipboard
Retry requests
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.
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.
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.
And it's causing issues for us again.
We're coming up on a fairly comprehensive review of godo. We'll look at introducing retries then.
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