Skip to content

Commit 7734af7

Browse files
committed
do not clear the pool on SystemOverloaded
1 parent 320cb54 commit 7734af7

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

pymongo/asynchronous/topology.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -890,7 +890,9 @@ async def _handle_error(self, address: _Address, err_ctx: _ErrorContext) -> None
890890
# Clear the pool.
891891
await server.reset(service_id)
892892
elif isinstance(error, ConnectionFailure):
893-
if isinstance(error, WaitQueueTimeoutError):
893+
if isinstance(error, WaitQueueTimeoutError) or error.has_error_label(
894+
"SystemOverloaded"
895+
):
894896
return
895897
# "Client MUST replace the server's description with type Unknown
896898
# ... MUST NOT request an immediate check of the server."

pymongo/synchronous/topology.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -888,7 +888,9 @@ def _handle_error(self, address: _Address, err_ctx: _ErrorContext) -> None:
888888
# Clear the pool.
889889
server.reset(service_id)
890890
elif isinstance(error, ConnectionFailure):
891-
if isinstance(error, WaitQueueTimeoutError):
891+
if isinstance(error, WaitQueueTimeoutError) or error.has_error_label(
892+
"SystemOverloaded"
893+
):
892894
return
893895
# "Client MUST replace the server's description with type Unknown
894896
# ... MUST NOT request an immediate check of the server."

0 commit comments

Comments
 (0)