Skip to content

Commit

Permalink
Add arguments to asyncio.Redis.from_url() which are not passed to `…
Browse files Browse the repository at this point in the history
…ConnectionPool`

Documentation specifies that the `kwargs` are pssed to `ConnectionPool` but some
arguments are not meant for it.
  • Loading branch information
kristjanvalur committed Jul 28, 2023
1 parent 2d8a128 commit 34a69ff
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion CHANGES
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
10 changes: 7 additions & 3 deletions redis/asyncio/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 34a69ff

Please sign in to comment.