Skip to content

Commit 2a8fbf3

Browse files
committed
quick fixes
1 parent 4393e0c commit 2a8fbf3

File tree

2 files changed

+3
-6
lines changed

2 files changed

+3
-6
lines changed

src/error.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -342,8 +342,6 @@ export class MongoRuntimeError extends MongoDriverError {
342342

343343
/**
344344
* An error generated when a primary server is marked stale, never directly thrown
345-
* @privateRemarks
346-
* Should **never** be directly instantiated.
347345
*
348346
* @public
349347
* @category Error

src/sdam/server_description.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,10 @@ export class ServerDescription {
112112
this.minRoundTripTime = options?.minRoundTripTime ?? 0;
113113
this.lastUpdateTime = now();
114114
this.lastWriteDate = hello?.lastWrite?.lastWriteDate ?? 0;
115+
// NOTE: This actually builds the stack string instead of holding onto the getter and all its
116+
// associated references. This is done to prevent a memory leak.
115117
this.error = options.error ?? null;
118+
this.error?.stack;
116119
// TODO(NODE-2674): Preserve int64 sent from MongoDB
117120
this.topologyVersion = this.error?.topologyVersion ?? hello?.topologyVersion ?? null;
118121
this.setName = hello?.setName ?? null;
@@ -126,10 +129,6 @@ export class ServerDescription {
126129
this.me = hello?.me?.toLowerCase() ?? null;
127130
this.$clusterTime = hello?.$clusterTime ?? null;
128131
this.iscryptd = Boolean(hello?.iscryptd);
129-
130-
// NOTE: This actually builds the stack string instead of holding onto the getter and all its
131-
// associated references. This is done to prevent a memory leak.
132-
if (options.error) options.error.stack;
133132
}
134133

135134
get hostAddress(): HostAddress {

0 commit comments

Comments
 (0)