Skip to content

Commit c7e26ae

Browse files
alxasfuckandymccurdy
authored andcommitted
Remove blocking behaviour from context manager __enter__
1 parent 1a41cfd commit c7e26ae

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

redis/lock.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,7 @@ def register_scripts(self):
149149
client.register_script(cls.LUA_REACQUIRE_SCRIPT)
150150

151151
def __enter__(self):
152-
# force blocking, as otherwise the user would have to check whether
153-
# the lock was actually acquired or not.
154-
if self.acquire(blocking=True):
152+
if self.acquire():
155153
return self
156154
raise LockError("Unable to acquire lock within the time specified")
157155

0 commit comments

Comments
 (0)