File tree Expand file tree Collapse file tree 2 files changed +7
-14
lines changed Expand file tree Collapse file tree 2 files changed +7
-14
lines changed Original file line number Diff line number Diff line change @@ -614,19 +614,12 @@ export class MongoClient extends TypedEventEmitter<MongoClientEvents> {
614
614
const topology = this . topology ;
615
615
this . topology = undefined ;
616
616
617
- await new Promise < void > ( ( resolve , reject ) => {
618
- topology . close ( { force } , error => {
619
- if ( error ) return reject ( error ) ;
620
- const { encrypter } = this [ kOptions ] ;
621
- if ( encrypter ) {
622
- return encrypter . closeCallback ( this , force , error => {
623
- if ( error ) return reject ( error ) ;
624
- resolve ( ) ;
625
- } ) ;
626
- }
627
- resolve ( ) ;
628
- } ) ;
629
- } ) ;
617
+ topology . close ( ) ;
618
+
619
+ const { encrypter } = this [ kOptions ] ;
620
+ if ( encrypter ) {
621
+ await encrypter . close ( this , force ) ;
622
+ }
630
623
}
631
624
632
625
/**
Original file line number Diff line number Diff line change @@ -469,7 +469,7 @@ export class Topology extends TypedEventEmitter<TopologyEvents> {
469
469
( err , server ) => {
470
470
if ( err ) {
471
471
this . close ( ) ;
472
- exitWithError ( err ) ;
472
+ return exitWithError ( err ) ;
473
473
}
474
474
475
475
const skipPingOnConnect = this . s . options [ Symbol . for ( '@@mdb.skipPingOnConnect' ) ] === true ;
You can’t perform that action at this time.
0 commit comments