File tree Expand file tree Collapse file tree 2 files changed +3
-6
lines changed
Expand file tree Collapse file tree 2 files changed +3
-6
lines changed Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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 {
You can’t perform that action at this time.
0 commit comments