Skip to content
Snippets Groups Projects
Verified Commit 20fd21e4 authored by Jonathan Weth's avatar Jonathan Weth :keyboard:
Browse files

Fix send_notification_for_done_task to work only with tasks started in foreground

parent 4a7b9277
No related branches found
No related tags found
1 merge request!1118Resolve "TaskUserAssignment matching query does not exist."
Pipeline #99834 canceled
...@@ -20,6 +20,12 @@ Changed ...@@ -20,6 +20,12 @@ Changed
* Rewrite of frontend using Vuetify * 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 Removed
~~~~~~~ ~~~~~~~
......
...@@ -66,6 +66,11 @@ def send_notification_for_done_task(task_id): ...@@ -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 # Wait five seconds to ensure that the client has received the final status
time.sleep(5) 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: if not assignment.result_fetched:
assignment.create_notification() assignment.create_notification()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment