From 96f1618168ab38b2ac10d875189e69a434cc8303 Mon Sep 17 00:00:00 2001 From: tcely Date: Tue, 11 Feb 2025 18:39:51 -0500 Subject: [PATCH] Check for the precise return value `task.locked_by_pid_running()` returns: - `True`: locked and PID exists - `False`: locked and PID does not exist - `None`: not locked_by, no PID to check --- tubesync/sync/views.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tubesync/sync/views.py b/tubesync/sync/views.py index c78b11f7..bd2f139d 100644 --- a/tubesync/sync/views.py +++ b/tubesync/sync/views.py @@ -826,7 +826,11 @@ class TasksView(ListView): 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_pid_running()` returns: + # - True: locked and PID exists + # - False: locked and PID does not exist + # - None: not locked_by, 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