Use the chunk manager properly
This commit is contained in:
@@ -14,7 +14,7 @@ type HTTPClient struct {
|
||||
Client *http.Client
|
||||
MaxRetries int
|
||||
Backoff func(attempt int) time.Duration
|
||||
CheckRespStatus func(resp *http.Response, err error, log *zap.SugaredLogger) bool
|
||||
CheckRespStatus func(resp *http.Response, err error) bool
|
||||
BearerToken string
|
||||
log *zap.SugaredLogger
|
||||
config config.ConfigInterface
|
||||
@@ -34,7 +34,7 @@ func (r *HTTPClient) Do(req *http.Request) (*http.Response, error) {
|
||||
var err error
|
||||
for attempt := 0; attempt < r.MaxRetries; attempt++ {
|
||||
resp, err = r.Client.Do(req)
|
||||
if !r.CheckRespStatus(resp, err, r.log) {
|
||||
if !r.CheckRespStatus(resp, err) {
|
||||
return resp, err
|
||||
}
|
||||
time.Sleep(r.Backoff(attempt))
|
||||
@@ -50,7 +50,7 @@ func NewHTTPClient(token string, maxRetries int, cfg config.ConfigInterface) *HT
|
||||
Backoff: func(attempt int) time.Duration {
|
||||
return time.Duration(attempt) * time.Second
|
||||
},
|
||||
CheckRespStatus: func(resp *http.Response, err error, log *zap.SugaredLogger) bool {
|
||||
CheckRespStatus: func(resp *http.Response, err error) bool {
|
||||
if err != nil {
|
||||
return true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user