Skip to content

Commit 05b4984

Browse files
committed
check for both labels
1 parent 7868ac5 commit 05b4984

File tree

4 files changed

+10
-8
lines changed

4 files changed

+10
-8
lines changed

pymongo/asynchronous/pool.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,8 +1030,8 @@ def _handle_connection_error(self, error: BaseException, phase: str, conn_id: in
10301030
# If found, add error labels.
10311031
if self.is_sdam or type(error) != AutoReconnect:
10321032
return
1033-
# error._add_error_label("SystemOverloadedError")
1034-
# error._add_error_label("RetryableError")
1033+
error._add_error_label("SystemOverloadedError")
1034+
error._add_error_label("RetryableError")
10351035

10361036
async def connect(self, handler: Optional[_MongoClientErrorHandler] = None) -> AsyncConnection:
10371037
"""Connect to Mongo and return a new AsyncConnection.

pymongo/asynchronous/topology.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -890,8 +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) or error.has_error_label(
894-
"SystemOverloadedError"
893+
if isinstance(error, WaitQueueTimeoutError) or (
894+
error.has_error_label("SystemOverloadedError")
895+
and error.has_error_label("RetryableError")
895896
):
896897
return
897898
# "Client MUST replace the server's description with type Unknown

pymongo/synchronous/pool.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,8 +1026,8 @@ def _handle_connection_error(self, error: BaseException, phase: str, conn_id: in
10261026
# If found, add error labels.
10271027
if self.is_sdam or type(error) != AutoReconnect:
10281028
return
1029-
# error._add_error_label("SystemOverloadedError")
1030-
# error._add_error_label("RetryableError")
1029+
error._add_error_label("SystemOverloadedError")
1030+
error._add_error_label("RetryableError")
10311031

10321032
def connect(self, handler: Optional[_MongoClientErrorHandler] = None) -> Connection:
10331033
"""Connect to Mongo and return a new Connection.

pymongo/synchronous/topology.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -888,8 +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) or error.has_error_label(
892-
"SystemOverloadedError"
891+
if isinstance(error, WaitQueueTimeoutError) or (
892+
error.has_error_label("SystemOverloadedError")
893+
and error.has_error_label("RetryableError")
893894
):
894895
return
895896
# "Client MUST replace the server's description with type Unknown

0 commit comments

Comments
 (0)