From 01e68f23973ae25f746766ac82268ccc94a58b02 Mon Sep 17 00:00:00 2001 From: Michael Collins <15347726+michaeljcollinsuk@users.noreply.github.com> Date: Fri, 29 Nov 2024 14:46:12 +0000 Subject: [PATCH] Add task completed debugging --- controlpanel/api/tasks/handlers/base.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/controlpanel/api/tasks/handlers/base.py b/controlpanel/api/tasks/handlers/base.py index 129b8488..24071a21 100644 --- a/controlpanel/api/tasks/handlers/base.py +++ b/controlpanel/api/tasks/handlers/base.py @@ -19,9 +19,12 @@ class BaseTaskHandler(CeleryTask): task_obj = None def complete(self): - if self.task_obj: - self.task_obj.completed = True - self.task_obj.save() + if not self.task_obj: + return log.warn("Task completed, but no object to mark as completed.") + + self.task_obj.completed = True + self.task_obj.save() + log.info(f"Task object completed: {self.task_obj.task_id}") def get_task_obj(self): task_id = self.request.id