Let Tasks expire correctly

This commit is contained in:
tcely 2025-02-05 16:26:58 -05:00 committed by GitHub
parent 26940c86b4
commit bc58e85a89
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -824,6 +824,11 @@ class TasksView(ListView):
queryset = self.get_queryset()
now = timezone.now()
for task in queryset:
# There is broken logic in Task.objects.locked(), work around it.
# Without this, the queue never resumes properly.
if task.locked_by and not task.locked_by_pid_running():
task.locked_by = None
task.save()
obj, url = map_task_to_instance(task)
if not obj:
# Orphaned task, ignore it (it will be deleted when it fires)