From 813f842e3de4546dd5e6e6df56729cd22b31d110 Mon Sep 17 00:00:00 2001 From: Dan Boxler Date: Thu, 8 Jun 2023 12:58:28 -0600 Subject: [PATCH 1/3] Allow `max_connections` to be set in RedisSettings --- arq/connections.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/arq/connections.py b/arq/connections.py index d4fc4434..aff34dc9 100644 --- a/arq/connections.py +++ b/arq/connections.py @@ -43,6 +43,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' @@ -250,6 +251,7 @@ def pool_factory(*args: Any, **kwargs: Any) -> ArqRedis: ssl_ca_certs=settings.ssl_ca_certs, ssl_ca_data=settings.ssl_ca_data, ssl_check_hostname=settings.ssl_check_hostname, + max_connections=settings.max_connections, ) while True: From c14d19a5ddddef40ed85d5e7aea365bfd5d6b75d Mon Sep 17 00:00:00 2001 From: Dan Boxler Date: Thu, 8 Jun 2023 13:26:18 -0600 Subject: [PATCH 2/3] fix tests --- tests/test_utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_utils.py b/tests/test_utils.py index e499d85f..c460348b 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -21,7 +21,7 @@ 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')" + "max_connections=None, sentinel=False, sentinel_master='mymaster')" ) == str(settings) From 8678b5e42aa6ab9e2eb0169de6b0b6f539b550e2 Mon Sep 17 00:00:00 2001 From: Samuel Colvin Date: Mon, 1 Apr 2024 15:30:03 +0100 Subject: [PATCH 3/3] fix tests --- tests/test_utils.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/test_utils.py b/tests/test_utils.py index db1e211d..9de66f88 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -225,6 +225,7 @@ def test_settings_plain(): 'retry_on_timeout': False, 'retry_on_error': None, 'retry': None, + 'max_connections': None, } @@ -253,4 +254,5 @@ def test_settings_from_socket_dsn(): 'retry_on_timeout': False, 'retry_on_error': None, 'retry': None, + 'max_connections': None, }