3 files changed
+462
No files matched your search
@@ -760,6 +760,18 @@ class TasksView(ListView):
|
||||
queryset = self.get_queryset()
|
||||
now = timezone.now()
|
||||
for task in queryset:
|
||||
# There was broken logic in `Task.objects.locked()`, work around it.
|
||||
# With that broken logic, the tasks never resume properly.
|
||||
# This check unlocks the tasks without a running process.
|
||||
# `task.locked_by_pid_running()` returns:
|
||||
# - `True`: locked and PID exists
|
||||
# - `False`: locked and PID does not exist
|
||||
# - `None`: not `locked_by`, so there was no PID to check
|
||||
if task.locked_by_pid_running() is False:
|
||||
task.locked_by = None
|
||||
# do not wait for the task to expire
|
||||
task.locked_at = None
|
||||
task.save()
|
||||
obj, url = map_task_to_instance(task)
|
||||
if not obj:
|
||||
# Orphaned task, ignore it (it will be deleted when it fires)
|
||||
|
||||
Reference in new issue
Block a user