Skip to content

A community-supported supercharged document management system: scan, index and archive all your documents

Fix: always update classifier task result (#9817)

shamoon924a13f724aa
diff --git a/src/documents/tasks.py b/src/documents/tasks.py
index 7d71d48c9..857ace928 100644
--- a/src/documents/tasks.py
+++ b/src/documents/tasks.py
@@ -123,14 +123,15 @@ def train_classifier(*, scheduled=True):
task.result = "Training data unchanged"
task.status = states.SUCCESS
- task.date_done = timezone.now()
- task.save(update_fields=["status", "result", "date_done"])
except Exception as e:
logger.warning("Classifier error: " + str(e))
task.status = states.FAILURE
task.result = str(e)
+ task.date_done = timezone.now()
+ task.save(update_fields=["status", "result", "date_done"])
+
@shared_task(bind=True)
def consume_file(