Additional configs

This commit is contained in:
Ben Sarmiento
2023-11-28 11:39:08 +01:00
parent 00c7e04795
commit a42a5eeb80
5 changed files with 30 additions and 7 deletions

View File

@@ -88,6 +88,9 @@ func (r *HTTPClient) Do(req *http.Request) (*http.Response, error) {
}
time.Sleep(r.Backoff(attempt))
}
if resp != nil {
resp.Body.Close()
}
}
}
}
@@ -109,7 +112,7 @@ func NewHTTPClient(token string, maxRetries int, timeoutSecs int, cfg config.Con
},
ShouldRetry: func(resp *http.Response, err error) int {
if resp != nil {
if resp.StatusCode == 429 || resp.StatusCode == 400 {
if resp.StatusCode == 429 || resp.StatusCode == 400 || resp.StatusCode == 403 {
return 0 // retry but don't increment attempt
}
return -1 // don't retry