Skip to content

Commit

Permalink
fix: ensure monitor has rtt pinger in when calculating rtt (#2757)
Browse files Browse the repository at this point in the history
  • Loading branch information
durran authored Mar 16, 2021
1 parent c976a01 commit b94519b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/core/sdam/monitor.js
Original file line number Diff line number Diff line change
Expand Up @@ -222,9 +222,10 @@ function checkServer(monitor, callback) {
}

const isMaster = result.result;
const duration = isAwaitable
? monitor[kRTTPinger].roundTripTime
: calculateDurationInMs(start);
const rttPinger = monitor[kRTTPinger];

const duration =
isAwaitable && rttPinger ? rttPinger.roundTripTime : calculateDurationInMs(start);

monitor.emit(
'serverHeartbeatSucceeded',
Expand Down

0 comments on commit b94519b

Please sign in to comment.