Comparing version 6.6.1 to 6.6.2-dev.20240516.sha.6acb5e5
@@ -139,3 +139,3 @@ "use strict"; | ||
get latestRtt() { | ||
return this.rttSampler.last ?? 0; // FIXME: Check if this is acceptable | ||
return this.rttSampler.last; | ||
} | ||
@@ -203,3 +203,4 @@ addRttSample(rtt) { | ||
// NOTE: here we use the latestRtt as this measurement corresponds with the value | ||
// obtained for this successful heartbeat | ||
// obtained for this successful heartbeat, if there is no latestRtt, then we calculate the | ||
// duration | ||
const duration = isAwaitable && monitor.rttPinger | ||
@@ -339,3 +340,3 @@ ? monitor.rttPinger.latestRtt ?? (0, utils_1.calculateDurationInMs)(start) | ||
this.monitor = monitor; | ||
this.latestRtt = monitor.latestRtt; | ||
this.latestRtt = monitor.latestRtt ?? undefined; | ||
const heartbeatFrequencyMS = monitor.options.heartbeatFrequencyMS; | ||
@@ -357,5 +358,2 @@ this[kMonitorId] = (0, timers_1.setTimeout)(() => this.measureRoundTripTime(), heartbeatFrequencyMS); | ||
measureAndReschedule(start, conn) { | ||
if (start == null) { | ||
start = (0, utils_1.now)(); | ||
} | ||
if (this.closed) { | ||
@@ -388,3 +386,3 @@ conn?.destroy(); | ||
// eslint-disable-next-line github/no-then | ||
connection.command((0, utils_1.ns)('admin.$cmd'), { [commandName]: 1 }, undefined).then(() => this.measureAndReschedule(), () => { | ||
connection.command((0, utils_1.ns)('admin.$cmd'), { [commandName]: 1 }, undefined).then(() => this.measureAndReschedule(start), () => { | ||
this.connection?.destroy(); | ||
@@ -391,0 +389,0 @@ this.connection = undefined; |
{ | ||
"name": "mongodb", | ||
"version": "6.6.1", | ||
"version": "6.6.2-dev.20240516.sha.6acb5e5", | ||
"description": "The official MongoDB driver for Node.js", | ||
@@ -178,2 +178,2 @@ "main": "lib/index.js", | ||
} | ||
} | ||
} |
@@ -222,4 +222,4 @@ import { clearTimeout, setTimeout } from 'timers'; | ||
get latestRtt(): number { | ||
return this.rttSampler.last ?? 0; // FIXME: Check if this is acceptable | ||
get latestRtt(): number | null { | ||
return this.rttSampler.last; | ||
} | ||
@@ -308,3 +308,4 @@ | ||
// NOTE: here we use the latestRtt as this measurement corresponds with the value | ||
// obtained for this successful heartbeat | ||
// obtained for this successful heartbeat, if there is no latestRtt, then we calculate the | ||
// duration | ||
const duration = | ||
@@ -503,3 +504,3 @@ isAwaitable && monitor.rttPinger | ||
this.monitor = monitor; | ||
this.latestRtt = monitor.latestRtt; | ||
this.latestRtt = monitor.latestRtt ?? undefined; | ||
@@ -526,6 +527,3 @@ const heartbeatFrequencyMS = monitor.options.heartbeatFrequencyMS; | ||
private measureAndReschedule(start?: number, conn?: Connection) { | ||
if (start == null) { | ||
start = now(); | ||
} | ||
private measureAndReschedule(start: number, conn?: Connection) { | ||
if (this.closed) { | ||
@@ -572,3 +570,3 @@ conn?.destroy(); | ||
connection.command(ns('admin.$cmd'), { [commandName]: 1 }, undefined).then( | ||
() => this.measureAndReschedule(), | ||
() => this.measureAndReschedule(start), | ||
() => { | ||
@@ -575,0 +573,0 @@ this.connection?.destroy(); |
Sorry, the diff of this file is not supported yet
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
3010507
62084
1