Wrap the error for max retries instead of logging separately

This commit is contained in:
Ben Adrian Sarmiento
2024-07-06 14:44:32 +02:00
parent 467f51bdec
commit acd18aca9a

View File

@@ -185,7 +185,7 @@ func (r *HTTPClient) Do(req *http.Request) (*http.Response, error) {
if incr > 0 {
attempt += incr
if attempt > r.maxRetries {
r.log.Warnf("Request to %s failed after %d attempts", req.URL.String(), r.maxRetries)
err = fmt.Errorf("max retries exceeded: %w", err)
break
}
time.Sleep(r.backoff(attempt))