Skip to content

Commit 751d473

Browse files
committed
finish retry.. need to test and add error
1 parent 6b57c23 commit 751d473

1 file changed

Lines changed: 7 additions & 5 deletions

File tree

operator/pkg/s3.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,21 @@ func RequestBatch(req *http.Request, ctx context.Context) func() (*http.Response
1717

1818
req_func := func() (*http.Response, error) {
1919
resp, err := http.DefaultClient.Do(req)
20+
if err != nil {
21+
// Handle Permanent Error cases here
2022

21-
if resp != nil {
22-
err := resp.Body.Close()
23-
if err != nil {
24-
return nil, err
23+
// From my understanding upon erroring, we close the response body to free the resources before trying???
24+
if resp != nil {
25+
err = resp.Body.Close()
26+
resp = nil
2527
}
2628
}
29+
2730
return resp, err
2831
}
2932
return req_func
3033
}
3134

32-
// TODO: How to log retries?
3335
func RequestBatchRetryable(ctx context.Context, logger logging.Logger, req *http.Request) (*http.Response, error) {
3436

3537
return retry.RetryWithData(RequestBatch(req, ctx), retry.DefaultRetryConfig())

0 commit comments

Comments
 (0)