DBZ-6113 Correct max reconnect attempts

Originally there are max+1 attempts
This commit is contained in:
Eugene Abramchuk 2023-02-15 22:33:19 +01:00 committed by Jiri Pechanec
parent a587b3b7ef
commit fcc44edf0b
2 changed files with 2 additions and 1 deletions

View File

@ -136,6 +136,7 @@ Eric Weaver
Eric S. Kreiseir
Erik Malm
Ethan Zou
Eugene Abramchuk
Ewen Cheslack-Postava
Ezer Karavani
Fabian Aussems

View File

@ -284,7 +284,7 @@ protected Supplier<MongoClient> preferredClientFor(ReplicaSet replicaSet, ReadPr
catch (Throwable t) {
handler.failed(attempts, maxAttempts - attempts, t);
}
if (attempts > maxAttempts) {
if (attempts >= maxAttempts) {
throw new ConnectException("Unable to connect to " + preference.getName() + " node of '" + replicaSet +
"' after " + attempts + " failed attempts");
}