Skip to content

Commit

Permalink
Add new retry policy adjustment method for when we have a response ob…
Browse files Browse the repository at this point in the history
…ject
  • Loading branch information
jguerra committed Sep 16, 2024
1 parent b008f90 commit f7f8ae5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -738,8 +738,8 @@ protected boolean isRetryable(final ErrorType err) {
if ((err == OutboundErrorType.RESET_CONNECTION)
|| (err == OutboundErrorType.CONNECT_ERROR)
|| (err == OutboundErrorType.READ_TIMEOUT
&& IDEMPOTENT_HTTP_METHODS.contains(
zuulRequest.getMethod().toUpperCase()))) {
&& IDEMPOTENT_HTTP_METHODS.contains(
zuulRequest.getMethod().toUpperCase()))) {
return isRequestReplayable();
}
return false;
Expand Down Expand Up @@ -908,7 +908,7 @@ protected void handleOriginNonSuccessResponse(final HttpResponse originResponse,

boolean retryable5xxResponse = isRetryable5xxResponse(zuulRequest, originResponse);
if (retryable5xxResponse) {
origin.adjustRetryPolicyIfNeeded(zuulRequest);
origin.adjustRetryPolicyIfNeeded(zuulRequest, originResponse);
}

if (retryable5xxResponse && isBelowRetryLimit()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@
import com.netflix.zuul.niws.RequestAttempt;
import com.netflix.zuul.passport.CurrentPassport;
import io.netty.channel.EventLoop;
import io.netty.handler.codec.http.HttpResponse;
import io.netty.util.concurrent.Promise;

import javax.annotation.Nullable;
import java.net.InetAddress;
import java.util.concurrent.atomic.AtomicReference;

Expand Down Expand Up @@ -77,4 +80,8 @@ RequestAttempt newRequestAttempt(
IClientConfig getClientConfig();

Registry getSpectatorRegistry();

default void adjustRetryPolicyIfNeeded(HttpRequestMessage zuulRequest, @Nullable HttpResponse response) {
adjustRetryPolicyIfNeeded(zuulRequest);
}
}

0 comments on commit f7f8ae5

Please sign in to comment.