Skip to content

Commit b94519b

Browse files
authored
fix: ensure monitor has rtt pinger in when calculating rtt (#2757)
1 parent c976a01 commit b94519b

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

lib/core/sdam/monitor.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,9 +222,10 @@ function checkServer(monitor, callback) {
222222
}
223223

224224
const isMaster = result.result;
225-
const duration = isAwaitable
226-
? monitor[kRTTPinger].roundTripTime
227-
: calculateDurationInMs(start);
225+
const rttPinger = monitor[kRTTPinger];
226+
227+
const duration =
228+
isAwaitable && rttPinger ? rttPinger.roundTripTime : calculateDurationInMs(start);
228229

229230
monitor.emit(
230231
'serverHeartbeatSucceeded',

0 commit comments

Comments
 (0)