diff --git a/beat/web/backend/models.py b/beat/web/backend/models.py index 2c4265e4c29be6cb08fe941c7ec99c7bda02cab9..5ef26916e0247feaaa36a6666d731d93fcb84fa1 100644 --- a/beat/web/backend/models.py +++ b/beat/web/backend/models.py @@ -424,8 +424,9 @@ class Worker(models.Model): if settings.DEBUG: cmdline += ['-vv'] # start newly assigned job splits - for split in JobSplit.objects.filter(worker=self, status=Job.QUEUED, - start_date__isnull=True, process_id__isnull=True): + for split in JobSplit.objects.select_for_update().filter(worker=self, + status=Job.QUEUED, start_date__isnull=True, + process_id__isnull=True): execute = pick_execute(split, environments) if execute is None: message = "Environment `%s' is not available for split " \