diff --git a/arq/connections.py b/arq/connections.py index 63c7ab82..c1058890 100644 --- a/arq/connections.py +++ b/arq/connections.py @@ -44,6 +44,7 @@ class RedisSettings: conn_timeout: int = 1 conn_retries: int = 5 conn_retry_delay: int = 1 + max_connections: Optional[int] = None sentinel: bool = False sentinel_master: str = 'mymaster' @@ -264,6 +265,7 @@ def pool_factory(*args: Any, **kwargs: Any) -> ArqRedis: retry=settings.retry, retry_on_timeout=settings.retry_on_timeout, retry_on_error=settings.retry_on_error, + max_connections=settings.max_connections, ) while True: diff --git a/tests/test_utils.py b/tests/test_utils.py index 74b90eca..9de66f88 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -22,7 +22,8 @@ def test_settings_changed(): "RedisSettings(host='localhost', port=123, unix_socket_path=None, database=0, username=None, password=None, " "ssl=False, ssl_keyfile=None, ssl_certfile=None, ssl_cert_reqs='required', ssl_ca_certs=None, " 'ssl_ca_data=None, ssl_check_hostname=False, conn_timeout=1, conn_retries=5, conn_retry_delay=1, ' - "sentinel=False, sentinel_master='mymaster', retry_on_timeout=False, retry_on_error=None, retry=None)" + "max_connections=None, sentinel=False, sentinel_master='mymaster', " + 'retry_on_timeout=False, retry_on_error=None, retry=None)' ) == str(settings) @@ -224,6 +225,7 @@ def test_settings_plain(): 'retry_on_timeout': False, 'retry_on_error': None, 'retry': None, + 'max_connections': None, } @@ -252,4 +254,5 @@ def test_settings_from_socket_dsn(): 'retry_on_timeout': False, 'retry_on_error': None, 'retry': None, + 'max_connections': None, }