File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -199,8 +199,10 @@ export async function performInitialHandshake(
199199 if ( error instanceof MongoError ) {
200200 error . addErrorLabel ( MongoErrorLabel . HandshakeError ) ;
201201 }
202- // If we encounter an error executing the initial handshake, apply backpressure labels.
203- applyBackpressureLabels ( error ) ;
202+ // If we encounter a network error executing the initial handshake, apply backpressure labels.
203+ if ( error instanceof MongoNetworkError ) {
204+ applyBackpressureLabels ( error ) ;
205+ }
204206
205207 throw error ;
206208 }
@@ -437,7 +439,9 @@ export async function makeSocket(options: MakeConnectionOptions): Promise<Stream
437439 socket = await connectedSocket ;
438440 return socket ;
439441 } catch ( error ) {
440- // If we encounter a SystemOverloaded error while establishing a socket, apply the backpressure labels to it.
442+ // If we encounter an error while establishing a socket, apply the backpressure labels to it. We cannot
443+ // differentiate between DNS, TLS errors and network errors without refactoring our connection establishment to
444+ // handle all three steps separately.
441445 applyBackpressureLabels ( error ) ;
442446 socket . destroy ( ) ;
443447 throw error ;
You can’t perform that action at this time.
0 commit comments