Skip to content

Commit

Permalink
fixed get_lock's parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
amirreza8002 committed Oct 7, 2024
1 parent 08796d0 commit e8abd46
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions django_valkey/async_cache/client/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,8 +294,10 @@ async def get_lock(
version: int | None = None,
timeout: float | int | None = None,
sleep: float = 0.1,
blocking: bool = True,
blocking_timeout: float | None = None,
client: AValkey | Any | None = None,
lock_class=None,
thread_local: bool = True,
) -> "Lock":
"""Returns a Lock object, the object then should be used in an async context manager"""
Expand All @@ -308,7 +310,9 @@ async def get_lock(
key,
timeout=timeout,
sleep=sleep,
blocking=blocking,
blocking_timeout=blocking_timeout,
lock_class=lock_class,
thread_local=thread_local,
)

Expand Down
4 changes: 4 additions & 0 deletions django_valkey/base_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,8 +423,10 @@ def get_lock(
version: int | None = None,
timeout: float | None = None,
sleep: float = 0.1,
blocking: bool = True,
blocking_timeout: float | None = None,
client: Backend | Any | None = None,
lock_class=None,
thread_local: bool = True,
) -> "Lock":
client = self._get_client(write=True, client=client)
Expand All @@ -434,7 +436,9 @@ def get_lock(
key,
timeout=timeout,
sleep=sleep,
blocking=blocking,
blocking_timeout=blocking_timeout,
lock_class=lock_class,
thread_local=thread_local,
)

Expand Down
4 changes: 4 additions & 0 deletions django_valkey/client/sharded.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,10 @@ def get_lock(
version=None,
timeout=None,
sleep=0.1,
blocking: bool = True,
blocking_timeout=None,
client=None,
lock_class=None,
thread_local=True,
):
if client is None:
Expand All @@ -295,8 +297,10 @@ def get_lock(
key,
timeout=timeout,
sleep=sleep,
blocking=blocking,
client=client,
blocking_timeout=blocking_timeout,
lock_class=lock_class,
thread_local=thread_local,
)

Expand Down

0 comments on commit e8abd46

Please sign in to comment.