Skip to content
This repository has been archived by the owner on Oct 25, 2023. It is now read-only.

Commit

Permalink
[issue-5] def acquire no longer takes key as argument (#6)
Browse files Browse the repository at this point in the history
  • Loading branch information
Matbj authored and mattrasband committed Dec 10, 2019
1 parent 36b385b commit 2f78bd5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions aioredis_lock/locks.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ async def renew_script(self) -> str:
return self._renew_script

async def __aenter__(self):
if await self.acquire(self.key, self.timeout, self.wait_timeout):
if await self.acquire(self.timeout, self.wait_timeout):
return self

raise LockTimeoutError("Unable to acquire lock within timeout")
Expand All @@ -83,11 +83,10 @@ async def is_owner(self) -> bool:
await self.pool_or_conn.get(self.key)
) == self._token.encode() # pylint: disable=no-member

async def acquire(self, key, timeout=30, wait_timeout=30) -> bool:
async def acquire(self, timeout=30, wait_timeout=30) -> bool:
"""
Attempt to acquire the lock
:param key: Lock key
:param timeout: Number of seconds until the lock should timeout. It can
be extended via extend
:param wait_timeout: How long to wait before aborting the lock request
Expand All @@ -97,7 +96,7 @@ async def acquire(self, key, timeout=30, wait_timeout=30) -> bool:
while True:
if await self._script_exec(
(await self.acquire_script()),
keys=[key],
keys=[self.key],
args=[self._token, timeout * 1000],
):
return True
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
from setuptools import find_packages, setup


__version__ = "0.0.3"
__version__ = "0.1.0"


with open(Path(__file__).parent / "README.md") as f:
Expand Down

0 comments on commit 2f78bd5

Please sign in to comment.