From c8a705218c84f3c70dfc382fb7eda897eddc50f0 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..c2b1486c 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("No Task 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