From bc58e85a89ca1e79ab97158d7750ce84969211b5 Mon Sep 17 00:00:00 2001 From: tcely Date: Wed, 5 Feb 2025 16:26:58 -0500 Subject: [PATCH] Let Tasks expire correctly --- tubesync/sync/views.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tubesync/sync/views.py b/tubesync/sync/views.py index 24ff6866..ca8405fd 100644 --- a/tubesync/sync/views.py +++ b/tubesync/sync/views.py @@ -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)