-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Closed
Description
Just a question: considering that Lock
sports a blocking
parameter:
Lines 66 to 67 in a3cfded
def __init__(self, redis, name, timeout=None, sleep=0.1, | |
blocking=True, blocking_timeout=None, thread_local=True): |
why is that same parameter missing from the lock()
function:
Lines 708 to 709 in b940d07
def lock(self, name, timeout=None, sleep=0.1, blocking_timeout=None, | |
lock_class=None, thread_local=True): |
which defaults to creating a Lock
instance? It would be nice to write
r = redis.StrictRedis()
with r.lock("my-lock", blocking=False):
pass # Do stuff.
which would either enter the with
block if the lock was acquired, or not. In my case, I wouldn’t even need the LockError()
here… (Now if with
had an else
it would be even more useful, alas 😉)
Metadata
Metadata
Assignees
Labels
No labels