Adjust the comment explaining the situation

This commit is contained in:
tcely 2025-02-11 18:50:23 -05:00 committed by GitHub
parent 96f1618168
commit 468c89f17c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -824,12 +824,13 @@ 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.
# 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, no PID to check
# - `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