diff --git a/CHANGELOG.rst b/CHANGELOG.rst index b38015dc1c58e0a6974608d1183d23d8b2815e8f..fd63ee124d6d3e563ae496f08fc31c57f4b21312 100644 --- a/CHANGELOG.rst +++ b/CHANGELOG.rst @@ -20,6 +20,12 @@ Changed * Rewrite of frontend using Vuetify +Fixed +~~~~~ + +* The system tried to send notifications for done background tasks + in addition to tasks started in the foreground. + Removed ~~~~~~~ diff --git a/aleksis/core/tasks.py b/aleksis/core/tasks.py index 8306203ee66228ef264b7d06f15e6eb46690b5ab..c7c6e1997daf2b01c569605ce3965c1948c59eb5 100644 --- a/aleksis/core/tasks.py +++ b/aleksis/core/tasks.py @@ -66,6 +66,11 @@ def send_notification_for_done_task(task_id): # Wait five seconds to ensure that the client has received the final status time.sleep(5) - assignment = TaskUserAssignment.objects.get(task_result__task_id=task_id) + try: + assignment = TaskUserAssignment.objects.get(task_result__task_id=task_id) + except TaskUserAssignment.DoesNotExist: + # No foreground task + return + if not assignment.result_fetched: assignment.create_notification()