Skip to content

Commit 91b8c4a

Browse files
authored
Use MaxConnectionsError in the asyncio pool too (#3859)
This aligns to the docs which indicate that this error type will be used when pool attempts to create more connections than are allowed. Fixes #3237
1 parent dd559eb commit 91b8c4a

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

redis/asyncio/connection.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@
5757
AuthenticationWrongNumberOfArgsError,
5858
ConnectionError,
5959
DataError,
60+
MaxConnectionsError,
6061
RedisError,
6162
ResponseError,
6263
TimeoutError,
@@ -1208,7 +1209,7 @@ def get_available_connection(self):
12081209
connection = self._available_connections.pop()
12091210
except IndexError:
12101211
if len(self._in_use_connections) >= self.max_connections:
1211-
raise ConnectionError("Too many connections") from None
1212+
raise MaxConnectionsError("Too many connections") from None
12121213
connection = self.make_connection()
12131214
self._in_use_connections.add(connection)
12141215
return connection

0 commit comments

Comments
 (0)