Skip to content

Commit 3774e99

Browse files
committed
conditionally kill connection when a CSOT error occurs
1 parent 997e321 commit 3774e99

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/cmap/connection.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -714,6 +714,7 @@ export class Connection extends TypedEventEmitter<ConnectionEvents> {
714714
let err = error;
715715
if (TimeoutError.is(error)) {
716716
err = new MongoOperationTimeoutError('Timed out at socket write');
717+
this.cleanup(err);
717718
}
718719
throw error;
719720
} finally {
@@ -757,7 +758,6 @@ export class Connection extends TypedEventEmitter<ConnectionEvents> {
757758
this.onError(error);
758759
throw error;
759760
}
760-
this.cleanup(err);
761761
throw err;
762762
} finally {
763763
this.dataEvents = null;

0 commit comments

Comments
 (0)