Skip to content

Commit db4332d

Browse files
committed
fix close conn behavior
1 parent 4f174f9 commit db4332d

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

pymongo/asynchronous/pool.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -594,7 +594,9 @@ def validate_session(
594594

595595
async def close_conn(self, reason: Optional[str]) -> None:
596596
"""Close this connection with a reason."""
597-
await super().close_conn(reason)
597+
if self.closed:
598+
return
599+
await self._close_conn()
598600
if reason:
599601
if self.enabled_for_cmap:
600602
assert self.listeners is not None

pymongo/synchronous/pool.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -592,7 +592,9 @@ def validate_session(
592592

593593
def close_conn(self, reason: Optional[str]) -> None:
594594
"""Close this connection with a reason."""
595-
super().close_conn(reason)
595+
if self.closed:
596+
return
597+
self._close_conn()
596598
if reason:
597599
if self.enabled_for_cmap:
598600
assert self.listeners is not None

0 commit comments

Comments
 (0)