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