File tree Expand file tree Collapse file tree 2 files changed +2
-6
lines changed Expand file tree Collapse file tree 2 files changed +2
-6
lines changed Original file line number Diff line number Diff line change @@ -786,7 +786,7 @@ export abstract class AbstractCursor<
786
786
} catch ( error ) {
787
787
squashError ( error ) ;
788
788
} finally {
789
- if ( ! session . hasEnded && session ?. owner === this ) {
789
+ if ( session ?. owner === this ) {
790
790
await session . endSession ( { error } ) ;
791
791
}
792
792
if ( ! session ?. inTransaction ( ) ) {
Original file line number Diff line number Diff line change @@ -533,11 +533,7 @@ export function maybeClearPinnedConnection(
533
533
const servers = Array . from ( topology . s . servers . values ( ) ) ;
534
534
const loadBalancer = servers [ 0 ] ;
535
535
536
- if (
537
- options ?. error == null ||
538
- options ?. error ?. name === 'MongoExpiredSessionError' ||
539
- options ?. force
540
- ) {
536
+ if ( options ?. error == null || options ?. force ) {
541
537
loadBalancer . pool . checkIn ( conn ) ;
542
538
session [ kPinnedConnection ] = undefined ;
543
539
conn . emit (
You can’t perform that action at this time.
0 commit comments