Skip to content

Commit d2e3354

Browse files
committed
PYTHON-5505 Allow retry write after overload error even if sessions are not supported
1 parent 6114788 commit d2e3354

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

pymongo/asynchronous/mongo_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2915,7 +2915,7 @@ async def _write(self) -> T:
29152915
and conn.supports_sessions
29162916
)
29172917
is_mongos = conn.is_mongos
2918-
if not sessions_supported:
2918+
if not self._always_retryable and not sessions_supported:
29192919
# A retry is not possible because this server does
29202920
# not support sessions raise the last error.
29212921
self._check_last_error()

pymongo/synchronous/mongo_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2905,7 +2905,7 @@ def _write(self) -> T:
29052905
and conn.supports_sessions
29062906
)
29072907
is_mongos = conn.is_mongos
2908-
if not sessions_supported:
2908+
if not self._always_retryable and not sessions_supported:
29092909
# A retry is not possible because this server does
29102910
# not support sessions raise the last error.
29112911
self._check_last_error()

0 commit comments

Comments
 (0)