Skip to content

Commit 99905cf

Browse files
Update async cluster to handle MaxConnectionsError separately
Add explanatory comment to the exception handling for MaxConnectionsError in the async cluster implementation, matching the synchronous version. This ensures consistent behavior between sync and async implementations when connection pool is exhausted, preventing unnecessary cluster reinitialization.
1 parent 4cb40d8 commit 99905cf

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

redis/asyncio/cluster.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -814,7 +814,13 @@ async def _execute_command(
814814
moved = False
815815

816816
return await target_node.execute_command(*args, **kwargs)
817-
except (BusyLoadingError, MaxConnectionsError):
817+
except BusyLoadingError:
818+
raise
819+
except MaxConnectionsError:
820+
# MaxConnectionsError indicates client-side resource exhaustion
821+
# (too many connections in the pool), not a node failure.
822+
# Don't treat this as a node failure - just re-raise the error
823+
# without reinitializing the cluster.
818824
raise
819825
except (ConnectionError, TimeoutError):
820826
# Connection retries are being handled in the node's

0 commit comments

Comments
 (0)