Skip to content

Commit a3bf87e

Browse files
Emmanuel326ash2k
authored andcommitted
network: stop retry backoff timer on context cancellation
1 parent d8ad62e commit a3bf87e

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

network/retry_requester.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,11 @@ func (r *retryRequester) waitForRetry(req *http.Request, resp *http.Response, bo
117117
WithField("duration", waitTime).
118118
Infoln("Waiting before making the next call")
119119

120+
timer := time.NewTimer(waitTime)
121+
defer timer.Stop()
122+
120123
select {
121-
case <-time.After(waitTime):
124+
case <-timer.C:
122125
return nil
123126
case <-req.Context().Done():
124127
return req.Context().Err()

0 commit comments

Comments
 (0)