HotSushi commented on code in PR #18070:
URL: https://github.com/apache/iceberg/pull/18070#discussion_r4050805465
##########
core/src/test/java/org/apache/iceberg/rest/TestExponentialHttpRequestRetryStrategy.java:
##########
@@ -249,4 +250,64 @@ public void
testRetryDoesNotHappenForNonIdempotentMethodWithoutIdempotencyKey(in
context.setRequest(new BasicHttpRequest("POST", "/"));
assertThat(retryStrategy.retryRequest(response, 3, context)).isFalse();
}
+
+ @Test
+ public void testKeyedRetryAbandonedWhenLifetimeExceeded() {
+ HttpRequestRetryStrategy strategy =
+ new ExponentialHttpRequestRetryStrategy(5, Duration.ofSeconds(1));
+ BasicHttpResponse response = new
BasicHttpResponse(HttpStatus.SC_SERVICE_UNAVAILABLE, "busy");
+ response.addHeader(new BasicHeader(HttpHeaders.RETRY_AFTER, "3600"));
+ HttpClientContext context = HttpClientContext.create();
+ BasicHttpRequest request = new BasicHttpRequest("POST", "/");
+ request.addHeader(RESTUtil.IDEMPOTENCY_KEY_HEADER, "key-abandon");
+ context.setRequest(request);
+ assertThat(strategy.retryRequest(response, 1, context)).isFalse();
Review Comment:
fixed the first-attempt time recording and also added a two-call test.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]