Skip to content

Commit abc8413

Browse files
committed
JAVA-461: the logic to spread requests around slaves may select a slave over latency limit
1 parent 29ef407 commit abc8413

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)