Show More
@@ -288,11 +288,8 b' def get_mutex_lock(client, lock_key, loc' | |||||
288 | class _RedisLockWrapper(object): |
|
288 | class _RedisLockWrapper(object): | |
289 | """LockWrapper for redis_lock""" |
|
289 | """LockWrapper for redis_lock""" | |
290 |
|
290 | |||
291 | def __init__(self): |
|
291 | @classmethod | |
292 | pass |
|
292 | def get_lock(cls): | |
293 |
|
||||
294 | @property |
|
|||
295 | def lock(self): |
|
|||
296 | return redis_lock.Lock( |
|
293 | return redis_lock.Lock( | |
297 | redis_client=client, |
|
294 | redis_client=client, | |
298 | name=lock_key, |
|
295 | name=lock_key, | |
@@ -301,8 +298,14 b' def get_mutex_lock(client, lock_key, loc' | |||||
301 | strict=True, |
|
298 | strict=True, | |
302 | ) |
|
299 | ) | |
303 |
|
300 | |||
|
301 | def __init__(self): | |||
|
302 | self.lock = self.get_lock() | |||
|
303 | ||||
304 | def acquire(self, wait=True): |
|
304 | def acquire(self, wait=True): | |
305 | return self.lock.acquire(wait) |
|
305 | try: | |
|
306 | return self.lock.acquire(wait) | |||
|
307 | except redis_lock.AlreadyAquited: | |||
|
308 | return False | |||
306 |
|
309 | |||
307 | def release(self): |
|
310 | def release(self): | |
308 | try: |
|
311 | try: |
General Comments 0
You need to be logged in to leave comments.
Login now