Skip to content

Commit e0f0298

Browse files
fix: allow canceling a request while it is waiting to retry
1 parent 4f70490 commit e0f0298

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

internal/requestconfig/requestconfig.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -466,7 +466,11 @@ func (cfg *RequestConfig) Execute() (err error) {
466466
res.Body.Close()
467467
}
468468

469-
time.Sleep(retryDelay(res, retryCount))
469+
select {
470+
case <-ctx.Done():
471+
return ctx.Err()
472+
case <-time.After(retryDelay(res, retryCount)):
473+
}
470474
}
471475

472476
// Save *http.Response if it is requested to, even if there was an error making the request. This is

0 commit comments

Comments
 (0)