Skip to content
This repository was archived by the owner on Apr 30, 2025. It is now read-only.

Commit 9983c22

Browse files
maxmoehldomdom82
andcommitted
fix: do not retry if context has been cancelled
The additional retry logic introduced by #337 caused any error to become retry-able if the request did not make it to the back end. This included errors that came from context cancellation. This commit makes requests non-retry-able as soon as the context has been cancelled. Co-Authored-By: Dominik Froehlich <[email protected]>
1 parent a39d4f5 commit 9983c22

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

proxy/round_tripper/proxy_round_tripper.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,11 @@ func isIdempotent(request *http.Request) bool {
441441
}
442442

443443
func (rt *roundTripper) isRetriable(request *http.Request, err error, trace *requestTracer) (bool, error) {
444+
// if the context has been cancelled we do not perform further retries
445+
if request.Context().Err() != nil {
446+
return false, request.Context().Err()
447+
}
448+
444449
// io.EOF errors are considered safe to retry for certain requests
445450
// Replace the error here to track this state when classifying later.
446451
if err == io.EOF && isIdempotent(request) {

0 commit comments

Comments
 (0)