Skip to content

Commit 34a69ff

Browse files
committed
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.
1 parent 2d8a128 commit 34a69ff

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

CHANGES

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
* Fix #2831, closing connections and sockets when garbage collected.
1+
* Fix #2831, add auto_close_connection_pool=True arg to asyncio.Redis.from_url()
22
* Fix incorrect redis.asyncio.Cluster type hint for `retry_on_error`
33
* Fix dead weakref in sentinel connection causing ReferenceError (#2767)
44
* Fix #2768, Fix KeyError: 'first-entry' in parse_xinfo_stream.

redis/asyncio/client.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,13 @@ class Redis(
104104
response_callbacks: MutableMapping[Union[str, bytes], ResponseCallbackT]
105105

106106
@classmethod
107-
def from_url(cls, url: str, **kwargs):
107+
def from_url(
108+
cls,
109+
url: str,
110+
single_connection_client: bool = False,
111+
auto_close_connection_pool: bool = True,
112+
**kwargs,
113+
):
108114
"""
109115
Return a Redis client object configured from the given URL
110116
@@ -144,8 +150,6 @@ class initializer. In the case of conflicting arguments, querystring
144150
arguments always win.
145151
146152
"""
147-
single_connection_client = kwargs.pop("single_connection_client", False)
148-
auto_close_connection_pool = kwargs.pop("auto_close_connection_pool", True)
149153
connection_pool = ConnectionPool.from_url(url, **kwargs)
150154
redis = cls(
151155
connection_pool=connection_pool,

0 commit comments

Comments
 (0)