File tree 2 files changed +14
-9
lines changed
driver/src/main/scala/core
2 files changed +14
-9
lines changed Original file line number Diff line number Diff line change @@ -1317,8 +1317,8 @@ private[reactivemongo] trait MongoDBSystem extends Actor { selfSystem =>
1317
1317
1318
1318
val updated = {
1319
1319
val respTo = response.header.responseTo
1320
- @ inline def event =
1321
- s " IsMaster ( ${isMaster.isMaster}, ${respTo}, ${_nodeSet.toShortString}) "
1320
+
1321
+ @ inline def event = s " IsMasterResponse ( ${isMaster.isMaster}, ${respTo}, ${_nodeSet.toShortString}) "
1322
1322
1323
1323
updateNodeSet(event) { nodeSet =>
1324
1324
val nodeSetWasReachable = nodeSet.isReachable
@@ -1327,8 +1327,14 @@ private[reactivemongo] trait MongoDBSystem extends Actor { selfSystem =>
1327
1327
val nanow = System .nanoTime()
1328
1328
1329
1329
// Update the details of the node corresponding to the response chan
1330
- val prepared =
1331
- nodeSet.updateNodeByChannelId(response.info.channelId) { node =>
1330
+ import nodeSet .{updateNodeByChannelId => updateNode }
1331
+
1332
+ val prepared = updateNode(response.info.channelId) { node =>
1333
+ if (respTo < node.pingInfo.lastIsMasterId) {
1334
+ warn(s " Skip node update for delated response # $respTo < last # ${node.pingInfo.lastIsMasterId}" )
1335
+
1336
+ node
1337
+ } else {
1332
1338
val pingTime : Long = {
1333
1339
if (node.pingInfo.lastIsMasterId == respTo) {
1334
1340
nanow - node.pingInfo.lastIsMasterTime
@@ -1389,6 +1395,7 @@ private[reactivemongo] trait MongoDBSystem extends Actor { selfSystem =>
1389
1395
1390
1396
n
1391
1397
}
1398
+ }
1392
1399
1393
1400
val discoveredNodes = isMaster.replicaSet.toSeq.flatMap {
1394
1401
_.hosts.collect {
Original file line number Diff line number Diff line change @@ -195,17 +195,15 @@ private[reactivemongo] final class Node(
195
195
}
196
196
197
197
lazy val toShortString = {
198
- def latency = {
199
- import pingInfo .{ ping => ns }
200
-
198
+ def hns (ns : Long ): String = {
201
199
if (ns < 1000L ) s " ${ns.toString}ns "
202
200
else if (ns < 100000000L ) s " ${(ns / 1000000L ).toString}ms "
203
201
else s " ${(ns / 1000000000L ).toString}s "
204
202
}
205
203
206
- s """ Node[ $name: $status< ${statusChanged} ns > ( ${authenticatedConnections.size}/ ${connected.size}/ ${connections
204
+ s """ Node[ $name: $status< ${hns( statusChanged)} > ( ${authenticatedConnections.size}/ ${connected.size}/ ${connections
207
205
.filterNot(_.signaling)
208
- .size} available connections), latency= ${latency }, authenticated={ ${authenticated
206
+ .size} available connections), latency= ${hns(pingInfo.ping) }, authenticated={ ${authenticated
209
207
.map(_.toShortString) mkString " , " }}] """
210
208
}
211
209
You can’t perform that action at this time.
0 commit comments