Skip to content

Commit

Permalink
Debug tasks (#1400)
Browse files Browse the repository at this point in the history
Add task completed debugging
  • Loading branch information
michaeljcollinsuk authored Nov 29, 2024
1 parent 184c6fc commit 7262e2d
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions controlpanel/api/tasks/handlers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 7262e2d

Please sign in to comment.