Skip to content

Commit 6f85ee4

Browse files
committed
Add an assertion to RetryState.isLastAttempt, making sure attempt limit does not conflict with timeout
1 parent 65e9bc6 commit 6f85ee4

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

driver-core/src/main/com/mongodb/internal/async/function/RetryState.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -358,9 +358,10 @@ public boolean isFirstAttempt() {
358358
* @see #attempt()
359359
*/
360360
private boolean isLastAttempt(final Throwable attemptException) {
361-
boolean lastIteration = loopState.isLastIteration();
362361
boolean operationTimeout = retryUntilTimeoutThrowsException && attemptException instanceof MongoOperationTimeoutException;
363-
return lastIteration || operationTimeout || attempt() == attempts - 1;
362+
boolean attemptLimit = attempt() == attempts - 1;
363+
assertFalse(operationTimeout && attemptLimit);
364+
return loopState.isLastIteration() || operationTimeout || attemptLimit;
364365
}
365366

366367
/**

0 commit comments

Comments
 (0)