Show More
@@ -323,11 +323,8 b' def get_mutex_lock(client, lock_key, loc' | |||||
323 | class _RedisLockWrapper(object): |
|
323 | class _RedisLockWrapper(object): | |
324 | """LockWrapper for redis_lock""" |
|
324 | """LockWrapper for redis_lock""" | |
325 |
|
325 | |||
326 | def __init__(self): |
|
326 | @classmethod | |
327 | pass |
|
327 | def get_lock(cls): | |
328 |
|
||||
329 | @property |
|
|||
330 | def lock(self): |
|
|||
331 | return redis_lock.Lock( |
|
328 | return redis_lock.Lock( | |
332 | redis_client=client, |
|
329 | redis_client=client, | |
333 | name=lock_key, |
|
330 | name=lock_key, | |
@@ -336,8 +333,14 b' def get_mutex_lock(client, lock_key, loc' | |||||
336 | strict=True, |
|
333 | strict=True, | |
337 | ) |
|
334 | ) | |
338 |
|
335 | |||
|
336 | def __init__(self): | |||
|
337 | self.lock = self.get_lock() | |||
|
338 | ||||
339 | def acquire(self, wait=True): |
|
339 | def acquire(self, wait=True): | |
|
340 | try: | |||
340 | return self.lock.acquire(wait) |
|
341 | return self.lock.acquire(wait) | |
|
342 | except redis_lock.AlreadyAquited: | |||
|
343 | return False | |||
341 |
|
344 | |||
342 | def release(self): |
|
345 | def release(self): | |
343 | try: |
|
346 | try: |
General Comments 0
You need to be logged in to leave comments.
Login now