From 34a69ff58c9606fc2cf66f188e820f790a8655e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kristj=C3=A1n=20Valur=20J=C3=B3nsson?= Date: Fri, 28 Jul 2023 10:23:59 +0000 Subject: [PATCH] Add arguments to `asyncio.Redis.from_url()` which are not passed to `ConnectionPool` Documentation specifies that the `kwargs` are pssed to `ConnectionPool` but some arguments are not meant for it. --- CHANGES | 2 +- redis/asyncio/client.py | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/CHANGES b/CHANGES index 879722caf1..363f2b927d 100644 --- a/CHANGES +++ b/CHANGES @@ -1,4 +1,4 @@ - * Fix #2831, closing connections and sockets when garbage collected. + * Fix #2831, add auto_close_connection_pool=True arg to asyncio.Redis.from_url() * Fix incorrect redis.asyncio.Cluster type hint for `retry_on_error` * Fix dead weakref in sentinel connection causing ReferenceError (#2767) * Fix #2768, Fix KeyError: 'first-entry' in parse_xinfo_stream. diff --git a/redis/asyncio/client.py b/redis/asyncio/client.py index a380f286c8..31e27a4462 100644 --- a/redis/asyncio/client.py +++ b/redis/asyncio/client.py @@ -104,7 +104,13 @@ class Redis( response_callbacks: MutableMapping[Union[str, bytes], ResponseCallbackT] @classmethod - def from_url(cls, url: str, **kwargs): + def from_url( + cls, + url: str, + single_connection_client: bool = False, + auto_close_connection_pool: bool = True, + **kwargs, + ): """ Return a Redis client object configured from the given URL @@ -144,8 +150,6 @@ class initializer. In the case of conflicting arguments, querystring arguments always win. """ - single_connection_client = kwargs.pop("single_connection_client", False) - auto_close_connection_pool = kwargs.pop("auto_close_connection_pool", True) connection_pool = ConnectionPool.from_url(url, **kwargs) redis = cls( connection_pool=connection_pool,