Skip to content

Commit af29c21

Browse files
ash2kEmmanuel326
andcommitted
Merge branch 'network-retry-context-cancel' into 'main'
network: stop retry backoff timer on context cancellation See merge request https://gitlab.com/gitlab-org/gitlab-runner/-/merge_requests/6063 Merged-by: Mikhail Mazurskiy <mmazurskiy@gitlab.com> Approved-by: Mikhail Mazurskiy <mmazurskiy@gitlab.com> Co-authored-by: Emmanuel326 <nyariboemmanuel8@gmail.com>
2 parents f6ad4cd + a3bf87e commit af29c21

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)