fix check if lock was acquired
This commit is contained in:
parent
0b3517de5b
commit
25a0a57be9
1 changed files with 2 additions and 2 deletions
|
@ -98,8 +98,8 @@ class MapUpdate(models.Model):
|
|||
lock_aquired = None
|
||||
lock = redis.Redis().lock('mapupdate:process_updates_lock')
|
||||
try:
|
||||
have_lock = lock.acquire(blocking=False, blocking_timeout=1800)
|
||||
if not have_lock:
|
||||
lock_aquired = lock.acquire(blocking=False, blocking_timeout=1800)
|
||||
if not lock_aquired:
|
||||
raise cls.ProcessUpdatesAlreadyRunning
|
||||
yield tuple(queryset)
|
||||
finally:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue