Skip to content

Commit 732cd6e

Browse files
committed
update pool clear logic
1 parent ae89b76 commit 732cd6e

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

pymongo/asynchronous/topology.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -887,9 +887,8 @@ async def _handle_error(self, address: _Address, err_ctx: _ErrorContext) -> None
887887
# Unknown command error during the connection handshake.
888888
if not self._settings.load_balanced:
889889
await self._process_change(ServerDescription(address, error=error))
890-
# Clear the pool if the backpressure label was not applied.
891-
if not error.has_error_label("SystemOverloadedError"):
892-
await server.reset(service_id)
890+
# Clear the pool.
891+
await server.reset(service_id)
893892
elif isinstance(error, ConnectionFailure):
894893
if isinstance(error, WaitQueueTimeoutError) or (
895894
error.has_error_label("SystemOverloadedError")

pymongo/synchronous/topology.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -885,9 +885,8 @@ def _handle_error(self, address: _Address, err_ctx: _ErrorContext) -> None:
885885
# Unknown command error during the connection handshake.
886886
if not self._settings.load_balanced:
887887
self._process_change(ServerDescription(address, error=error))
888-
# Clear the pool if the backpressure label was not applied.
889-
if not error.has_error_label("SystemOverloadedError"):
890-
server.reset(service_id)
888+
# Clear the pool.
889+
server.reset(service_id)
891890
elif isinstance(error, ConnectionFailure):
892891
if isinstance(error, WaitQueueTimeoutError) or (
893892
error.has_error_label("SystemOverloadedError")

0 commit comments

Comments
 (0)