diff options
author | Jon Marius Venstad <jonmv@users.noreply.github.com> | 2024-05-21 17:09:25 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-05-21 17:09:25 +0200 |
commit | ec16b9b22481abf0959720fdec8a67c74bdce475 (patch) | |
tree | 7895e6fee91d4c3728feb664c7ee4b3387eb5138 /vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/HttpRequestStrategy.java | |
parent | 3d65e159d42ff317ca52107960c19af1a431afd1 (diff) | |
parent | 19d3c4448090576bc37f611794c5ee5799cde9f5 (diff) |
Merge pull request #31266 from vespa-engine/revert-31228-jonmv/feed-retry-grace-periodv8.345.20
Revert "Retry requests within retry count limit OR grace period (default 10s)" MERGEOK
Diffstat (limited to 'vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/HttpRequestStrategy.java')
-rw-r--r-- | vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/HttpRequestStrategy.java | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/HttpRequestStrategy.java b/vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/HttpRequestStrategy.java index f699651634a..8f0327a1738 100644 --- a/vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/HttpRequestStrategy.java +++ b/vespa-feed-client/src/main/java/ai/vespa/feed/client/impl/HttpRequestStrategy.java @@ -31,7 +31,6 @@ import static java.nio.charset.StandardCharsets.UTF_8; import static java.util.logging.Level.FINE; import static java.util.logging.Level.FINER; import static java.util.logging.Level.FINEST; -import static java.util.logging.Level.SEVERE; import static java.util.logging.Level.WARNING; /** @@ -97,7 +96,7 @@ class HttpRequestStrategy implements RequestStrategy { } } catch (Throwable t) { - log.log(SEVERE, "Dispatch thread threw; shutting down", t); + log.log(WARNING, "Dispatch thread threw; shutting down", t); } destroy(); } @@ -120,7 +119,7 @@ class HttpRequestStrategy implements RequestStrategy { } private boolean retry(HttpRequest request, int attempt) { - if (attempt > strategy.retries() || request.timeLeft().toMillis() <= 0) + if (attempt > strategy.retries()) return false; switch (request.method().toUpperCase()) { @@ -138,6 +137,7 @@ class HttpRequestStrategy implements RequestStrategy { private boolean retry(HttpRequest request, Throwable thrown, int attempt) { breaker.failure(thrown); if ( (thrown instanceof IOException) // General IO problems. + // Thrown by HTTP2Session.StreamsState.reserveSlot, likely on GOAWAY from server || (thrown instanceof IllegalStateException && thrown.getMessage().equals("session closed")) ) { @@ -149,7 +149,7 @@ class HttpRequestStrategy implements RequestStrategy { return false; } - /** Retries throttled requests (429), adjusting the target inflight count, and server unavailable (503). */ + /** Retries throttled requests (429), adjusting the target inflight count, and server errors (500, 502, 503, 504). */ private boolean retry(HttpRequest request, HttpResponse response, int attempt) { if (response.code() / 100 == 2 || response.code() == 404 || response.code() == 412) { logResponse(FINEST, response, request, attempt); @@ -272,8 +272,7 @@ class HttpRequestStrategy implements RequestStrategy { } /** Handles the result of one attempt at the given operation, retrying if necessary. */ - private void handleAttempt(CompletableFuture<HttpResponse> vessel, HttpRequest request, - RetriableFuture<HttpResponse> result, int attempt) { + private void handleAttempt(CompletableFuture<HttpResponse> vessel, HttpRequest request, RetriableFuture<HttpResponse> result, int attempt) { vessel.whenCompleteAsync((response, thrown) -> { result.set(response, thrown); // Retry the operation if it failed with a transient error ... |