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
This commit is contained in:
tcely 2025-02-11 18:39:51 -05:00 committed by GitHub
parent a7f872e902
commit 96f1618168
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -826,7 +826,11 @@ class TasksView(ListView):
for task in queryset: for task in queryset:
# There is broken logic in Task.objects.locked(), work around it. # There is broken logic in Task.objects.locked(), work around it.
# Without this, the queue never resumes properly. # 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 task.locked_by = None
# do not wait for the task to expire # do not wait for the task to expire
task.locked_at = None task.locked_at = None