process_updates() don't lock globally, but only on unprocessed updates
This commit is contained in:
parent
4e9f34d4a0
commit
e1d27b637c
3 changed files with 16 additions and 6 deletions
|
@ -81,8 +81,8 @@ class MapUpdate(models.Model):
|
|||
|
||||
@classmethod
|
||||
def process_updates(cls):
|
||||
with cls.lock():
|
||||
new_updates = tuple(cls.objects.filter(processed=False))
|
||||
with transaction.atomic():
|
||||
new_updates = tuple(cls.objects.filter(processed=False).select_for_update(nowait=True))
|
||||
if not new_updates:
|
||||
return ()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue