Skip to content

Commit 61baff7

Browse files
rebase
1 parent b1e2d42 commit 61baff7

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

src/sdam/monitor.ts

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,6 @@ export class Monitor extends TypedEventEmitter<MonitorEvents> {
101101
/** @internal */
102102
override component = MongoLoggableComponent.TOPOLOGY;
103103

104-
get connection(): Connection | undefined {
105-
return this[kConnection];
106-
}
107-
108104
constructor(server: Server, options: MonitorOptions) {
109105
super();
110106

@@ -264,8 +260,6 @@ function checkServer(monitor: Monitor, callback: Callback<Document | null>) {
264260
awaited
265261
)
266262
);
267-
monitor[kConnection]?.destroy({ force: true });
268-
monitor[kConnection] = undefined;
269263

270264
const error = !(err instanceof MongoError)
271265
? new MongoError(MongoError.buildErrorMessage(err), { cause: err })
@@ -290,17 +284,23 @@ function checkServer(monitor: Monitor, callback: Callback<Document | null>) {
290284
? monitor.rttPinger.roundTripTime
291285
: calculateDurationInMs(start);
292286

293-
monitor.emit(
287+
monitor.emitAndLog(
294288
Server.SERVER_HEARTBEAT_SUCCEEDED,
295-
new ServerHeartbeatSucceededEvent(monitor.address, duration, hello, isAwaitable)
289+
new ServerHeartbeatSucceededEvent(
290+
monitor[kServer].topology.s.id,
291+
monitor.address,
292+
duration,
293+
hello,
294+
isAwaitable
295+
)
296296
);
297297

298298
// If we are using the streaming protocol then we immediately issue another 'started'
299299
// event, otherwise the "check" is complete and return to the main monitor loop.
300300
if (isAwaitable) {
301-
monitor.emit(
301+
monitor.emitAndLog(
302302
Server.SERVER_HEARTBEAT_STARTED,
303-
new ServerHeartbeatStartedEvent(monitor.address, true)
303+
new ServerHeartbeatStartedEvent(monitor[kServer].topology.s.id, monitor.address, true)
304304
);
305305
start = now();
306306
} else {
@@ -378,7 +378,7 @@ function checkServer(monitor: Monitor, callback: Callback<Document | null>) {
378378
}
379379

380380
monitor.connection = conn;
381-
monitor.emit(
381+
monitor.emitAndLog(
382382
Server.SERVER_HEARTBEAT_SUCCEEDED,
383383
new ServerHeartbeatSucceededEvent(
384384
monitor[kServer].topology.s.id,

0 commit comments

Comments
 (0)