Skip to content

Commit

Permalink
Remove unneeded sesson pings
Browse files Browse the repository at this point in the history
  • Loading branch information
NoahStapp committed Feb 2, 2024
1 parent 2f9bb20 commit 4d9b965
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 3 additions & 1 deletion pymongo/mongo_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -2387,7 +2387,9 @@ def _write(self) -> T:
with self._client._checkout(self._server, self._session) as conn:
max_wire_version = conn.max_wire_version
sessions_supported = (
self._server.description.retryable_writes_supported and conn.supports_sessions
self._session
and self._server.description.retryable_writes_supported
and conn.supports_sessions
)
if not sessions_supported:
# A retry is not possible because this server does
Expand Down
3 changes: 1 addition & 2 deletions test/test_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,7 @@ def test_end_sessions(self):
# Start many sessions.
sessions = [client.start_session() for _ in range(_MAX_END_SESSIONS + 1)]
for s in sessions:
client.admin.command("ping", session=s)
for s in sessions:
s._materialize()
s.end_session()

# Closing the client should end all sessions and clear the pool.
Expand Down

0 comments on commit 4d9b965

Please sign in to comment.