Need Help Implementing go-resty retrycondition: Best Practices and Examples?

10 Replies, 2303 Views

Hey! For go-resty retrycondition, I usually check for 5xx status codes and timeouts.

Here's a quick snippet I use:
```go
client.SetRetryCondition(func(r *resty.Response, err error) bool {
return r.StatusCode() >= 500 || err != nil
})
```
Also, set a max retry count with `SetRetryCount()` to avoid spamming the server. Works like a charm in prod!

Messages In This Thread



Users browsing this thread: 1 Guest(s)