summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichał Masłowski <m.maslowski@clearcode.cc>2018-05-23 16:02:56 +0200
committerMichał Masłowski <m.maslowski@clearcode.cc>2018-05-23 16:03:30 +0200
commiteb6a34dab4d316a7c8ea186775321458e033e3d3 (patch)
tree65ca7e05c83ac9a41db1f5a60c6d25921d0d0bb9
parent2035e9821ebf2d884f10928e9c88e17179ac4842 (diff)
downloadredis-py-eb6a34dab4d316a7c8ea186775321458e033e3d3.tar.gz
Fix parsing max_connections URL query string parameter
Previously ConnectionPool.from_url kept it as a string, causing a 'ValueError: "max_connections" must be a positive integer'.
-rwxr-xr-xredis/connection.py3
-rw-r--r--tests/test_connection_pool.py3
2 files changed, 4 insertions, 2 deletions
diff --git a/redis/connection.py b/redis/connection.py
index 6ad467a..25c1f73 100755
--- a/redis/connection.py
+++ b/redis/connection.py
@@ -779,7 +779,8 @@ URL_QUERY_ARGUMENT_PARSERS = {
'socket_timeout': float,
'socket_connect_timeout': float,
'socket_keepalive': to_bool,
- 'retry_on_timeout': to_bool
+ 'retry_on_timeout': to_bool,
+ 'max_connections': int,
}
diff --git a/tests/test_connection_pool.py b/tests/test_connection_pool.py
index 11c2008..56a73fe 100644
--- a/tests/test_connection_pool.py
+++ b/tests/test_connection_pool.py
@@ -240,7 +240,7 @@ class TestConnectionPoolURLParsing(object):
def test_extra_typed_querystring_options(self):
pool = redis.ConnectionPool.from_url(
'redis://localhost/2?socket_timeout=20&socket_connect_timeout=10'
- '&socket_keepalive=&retry_on_timeout=Yes'
+ '&socket_keepalive=&retry_on_timeout=Yes&max_connections=10'
)
assert pool.connection_class == redis.Connection
@@ -253,6 +253,7 @@ class TestConnectionPoolURLParsing(object):
'retry_on_timeout': True,
'password': None,
}
+ assert pool.max_connections == 10
def test_boolean_parsing(self):
for expected, value in (