Skip to content

Commit 43284f0

Browse files
committed
JAVA-1284: MongoTimeoutException should include the total time waited before timing out, not just the last time through the loop
1 parent d7d2c90 commit 43284f0

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/main/com/mongodb/BaseCluster.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public Server getServer(final ServerSelector serverSelector, final long maxWaitT
8585

8686
if (!currentPhase.await(timeout, NANOSECONDS)) {
8787
throw new MongoTimeoutException(format("Timed out while waiting for a server that matches %s after %d ms",
88-
serverSelector, MILLISECONDS.convert(timeout, NANOSECONDS)));
88+
serverSelector, MILLISECONDS.convert(maxWaitTime, timeUnit)));
8989
}
9090
currentPhase = phase.get();
9191
curDescription = description;
@@ -112,7 +112,7 @@ public ClusterDescription getDescription(final long maxWaitTime, final TimeUnit
112112

113113
if (!currentPhase.await(timeout, NANOSECONDS)) {
114114
throw new MongoTimeoutException(format("Timed out while waiting to connect after %d ms",
115-
MILLISECONDS.convert(timeout, NANOSECONDS)));
115+
MILLISECONDS.convert(maxWaitTime, timeUnit)));
116116
}
117117
currentPhase = phase.get();
118118
curDescription = description;

0 commit comments

Comments
 (0)