Adjust the running tasks query set

The 12 hour limit may not be needed, but my task history rows are odd from testing at the moment.
This commit is contained in:
tcely authored and GitHub committed 2025-07-05 03:40:24 -04:00
1 parent f456c22b30
commit 4013d60a00
1 file changed
+6 -3
+6 -3
View File
@@ -867,9 +867,12 @@ class TasksView(ListView):
data = super().get_context_data(*args, **kwargs)
now_dt = timezone.now()
scheduled_qs = get_waiting_tasks()
running_qs = scheduled_qs.filter(
start_at__isnull=False,
end_at__lte=F('start_at'),
# Huey removes running tasks,
# so the waiting tasks will not include them.
running_qs = TaskHistory.objects.filter(
start_at=F('end_at'),
scheduled_at__lte=F('end_at'),
end_at__gte=now_dt-timezone.timedelta(hours=12),
)
errors_qs = scheduled_qs.filter(
attempts__gt=0