protect retryRequset from segfaults (#3292)
#### Does this PR need a docs update or release note? - [x] ⛔ No #### Type of change - [x] 🐛 Bugfix #### Issue(s) * #3285 #### Test Plan - [x] 💚 E2E
This commit is contained in:
parent
d478725a04
commit
b2054a630d
@ -227,10 +227,11 @@ func (mw RetryMiddleware) retryRequest(
|
|||||||
exponentialBackoff *backoff.ExponentialBackOff,
|
exponentialBackoff *backoff.ExponentialBackOff,
|
||||||
priorErr error,
|
priorErr error,
|
||||||
) (*http.Response, error) {
|
) (*http.Response, error) {
|
||||||
ctx = clues.Add(
|
ctx = clues.Add(ctx, "retry_count", executionCount)
|
||||||
ctx,
|
|
||||||
"retry_count", executionCount,
|
if resp != nil {
|
||||||
"prev_resp_status", resp.Status)
|
ctx = clues.Add(ctx, "prev_resp_status", resp.Status)
|
||||||
|
}
|
||||||
|
|
||||||
// only retry under certain conditions:
|
// only retry under certain conditions:
|
||||||
// 1, there was an error. 2, the resp and/or status code match retriable conditions.
|
// 1, there was an error. 2, the resp and/or status code match retriable conditions.
|
||||||
@ -258,16 +259,16 @@ func (mw RetryMiddleware) retryRequest(
|
|||||||
case <-timer.C:
|
case <-timer.C:
|
||||||
}
|
}
|
||||||
|
|
||||||
response, err := pipeline.Next(req, middlewareIndex)
|
nextResp, err := pipeline.Next(req, middlewareIndex)
|
||||||
if err != nil && !IsErrTimeout(err) && !IsErrConnectionReset(err) {
|
if err != nil && !IsErrTimeout(err) && !IsErrConnectionReset(err) {
|
||||||
return response, stackReq(ctx, req, response, err)
|
return nextResp, stackReq(ctx, req, nextResp, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return mw.retryRequest(ctx,
|
return mw.retryRequest(ctx,
|
||||||
pipeline,
|
pipeline,
|
||||||
middlewareIndex,
|
middlewareIndex,
|
||||||
req,
|
req,
|
||||||
response,
|
nextResp,
|
||||||
executionCount,
|
executionCount,
|
||||||
cumulativeDelay,
|
cumulativeDelay,
|
||||||
exponentialBackoff,
|
exponentialBackoff,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user