adoroszlai commented on code in PR #1025:
URL: https://github.com/apache/ratis/pull/1025#discussion_r1461737506
##########
ratis-test/src/test/java/org/apache/ratis/RaftLogTruncateTests.java:
##########
Review Comment:
Doesn't this belong to RATIS-2011?
##########
ratis-client/src/main/java/org/apache/ratis/client/impl/OrderedAsync.java:
##########
@@ -199,30 +195,26 @@ private void sendRequestWithRetry(PendingOrderedRequest
pending) {
return;
}
- final RetryPolicy retryPolicy = client.getRetryPolicy();
sendRequest(pending).exceptionally(e -> {
if (e instanceof CompletionException) {
e = JavaUtils.unwrapCompletionException(e);
- scheduleWithTimeout(pending, request, retryPolicy, e);
+ scheduleWithTimeout(pending, request, e);
return null;
}
f.completeExceptionally(e);
return null;
});
}
- private void scheduleWithTimeout(PendingOrderedRequest pending,
- RaftClientRequest request, RetryPolicy retryPolicy, Throwable e) {
- final int attempt = pending.getAttemptCount();
- final ClientRetryEvent event = new ClientRetryEvent(request, e, pending);
+ private void scheduleWithTimeout(PendingOrderedRequest pending,
RaftClientRequest request, Throwable e) {
+ final RetryPolicy retryPolicy = client.getRetryPolicy();
+ final ClientRetryEvent event = pending.newClientRetryEvent(request, e);
final TimeDuration sleepTime = client.getEffectiveSleepTime(e,
retryPolicy.handleAttemptFailure(event).getSleepTime());
- LOG.debug("schedule* attempt #{} with sleep {} and policy {} for {}",
attempt, sleepTime, retryPolicy, request);
- scheduleWithTimeout(pending, sleepTime, getSlidingWindow(request));
- }
+ LOG.debug("schedule* attempt #{} with sleep {} and policy {} for {}",
+ pending.getAttemptCount(), sleepTime, retryPolicy, request);
Review Comment:
nit: get attempt count from `event` (where it's `final`) instead of `pending`
```suggestion
event.getAttemptCount(), sleepTime, retryPolicy, request);
```
--
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]