From 4aedc2e94a81d17c4584aacf10478d6b432a829b Mon Sep 17 00:00:00 2001
From: Vermaas <vermaas@astron.nl>
Date: Fri, 16 Feb 2024 13:34:35 +0100
Subject: [PATCH] only update_activity on statusses that actually do updates
 (to speed it up)

---
 atdb/taskdatabase/templates/taskdatabase/index.html | 2 +-
 atdb/taskdatabase/views.py                          | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/atdb/taskdatabase/templates/taskdatabase/index.html b/atdb/taskdatabase/templates/taskdatabase/index.html
index 178726d1..3013df41 100644
--- a/atdb/taskdatabase/templates/taskdatabase/index.html
+++ b/atdb/taskdatabase/templates/taskdatabase/index.html
@@ -31,7 +31,7 @@
             {% include 'taskdatabase/pagination.html' %}
         </div>
     </div>
-    <p class="footer"> Version 16 Feb 2024 (11:00)
+    <p class="footer"> Version 16 Feb 2024 (13:30)
 </div>
 
 {% include 'taskdatabase/refresh.html' %}
diff --git a/atdb/taskdatabase/views.py b/atdb/taskdatabase/views.py
index 16c5bc89..18df3dc5 100644
--- a/atdb/taskdatabase/views.py
+++ b/atdb/taskdatabase/views.py
@@ -1730,6 +1730,7 @@ def UpdateAllActivities(request):
 
     return redirect('index')
 
+
 def UpdateActivitySasId(request, sas_id):
     # this function is called externally to avoid worker timeouts
     # http://localhost:8000/atdb/tasks/repair/update-activity/600907
@@ -1743,7 +1744,7 @@ def UpdateActivitySasId(request, sas_id):
 
         for task in tasks:
             i += 1
-            if task.status not in ['discarded', 'suspended']:
+            if task.status in ['stored', 'validated','scrubbed','archiving', 'archived','finished'] or 'failed' in task.status:
                 activities_handler.update_activity(task)
 
             logger.info(f'{i} of {total} for sas_id = {sas_id}')
-- 
GitLab