Closed
Description
Thanks for wanting to report an issue you've found in redis-py. Please delete this text and fill in the template below.
It is of course not always possible to reduce your code to a small test case, but it's highly appreciated to have as much data as possible. Thank you!
Version: 4.3.4
Platform: Python 3.11.0 on Mac OS
Description: I am trying use async lock but if you try init lock from Redis class, you will find that you can't use argument blocking from Lock class.
from redis import asyncio as aioredis
r = aioredis.from_url("redis://localhost:6379", decode_responses=True, encoding="utf-8")
async with r.lock("test", blocking=False):
...
but I can use next syntax:
from redis import asyncio as aioredis
from redis.asyncio.lock import Lock as AsyncLock
r = aioredis.from_url("redis://localhost:6379", decode_responses=True, encoding="utf-8")
async with AsyncLock("test", blocking=False)
Lock initialization function in a Redis class.
def lock(
self,
name: KeyT,
timeout: Optional[float] = None,
sleep: float = 0.1,
blocking_timeout: Optional[float] = None,
lock_class: Optional[Type[Lock]] = None,
thread_local: bool = True,
) -> Lock:
...
Lock class
def __init__(
self,
redis: "Redis",
name: Union[str, bytes, memoryview],
timeout: Optional[float] = None,
sleep: float = 0.1,
blocking: bool = True,
blocking_timeout: Optional[float] = None,
thread_local: bool = True,
):
...
Metadata
Metadata
Assignees
Labels
No labels