Skip to content

Commit d5ef166

Browse files
author
Ryan
committed
Merge branch 'master' of github.com:mongodb/mongo-java-driver
2 parents 4e13694 + abc8413 commit d5ef166

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main/com/mongodb/ReplicaSetStatus.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ static ServerAddress getASecondary( final String pTagKey,
200200
float diff = best._pingTime - n._pingTime;
201201

202202
// this is a complex way to make sure we get a random distribution of slaves
203-
if ( diff > slaveAcceptableLatencyMS || ( ( badBeforeBest - mybad ) / ( nodeCount - 1 ) ) > pRandom.nextDouble() ) {
203+
if ( diff > slaveAcceptableLatencyMS || ( ( badBeforeBest - mybad ) / ( nodeCount - 1 ) ) > pRandom.nextDouble() && diff > -1*slaveAcceptableLatencyMS ) {
204204
best = n;
205205
badBeforeBest = mybad;
206206
mybad = 0;

0 commit comments

Comments
 (0)