Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions pymongo/asynchronous/monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,8 @@ async def _run(self) -> None:
finally:
if self._executor._stopped:
await self._rtt_monitor.close()
# Make sure no connections outlive close().
await self._reset_connection()
Comment thread
NoahStapp marked this conversation as resolved.
Resolved

async def _check_server(self) -> ServerDescription:
"""Call hello or read the next streaming response.
Expand Down Expand Up @@ -440,6 +442,10 @@ async def _run(self) -> None:
await self.close()
except Exception:
await self._pool.reset()
finally:
if self._executor._stopped:
# Make sure no connections outlive close().
await self._pool.reset()

async def _ping(self) -> float:
"""Run a "hello" command and return the RTT."""
Expand Down
6 changes: 6 additions & 0 deletions pymongo/synchronous/monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,8 @@ def _run(self) -> None:
finally:
if self._executor._stopped:
self._rtt_monitor.close()
# Make sure no connections outlive close().
self._reset_connection()

def _check_server(self) -> ServerDescription:
"""Call hello or read the next streaming response.
Expand Down Expand Up @@ -438,6 +440,10 @@ def _run(self) -> None:
self.close()
except Exception:
self._pool.reset()
finally:
if self._executor._stopped:
# Make sure no connections outlive close().
self._pool.reset()

def _ping(self) -> float:
"""Run a "hello" command and return the RTT."""
Expand Down
Loading