From 977c6f8d650d57abae0ae003d125628b546ac122 Mon Sep 17 00:00:00 2001 From: Tommy Beadle Date: Wed, 26 Jun 2024 09:20:17 -0400 Subject: [PATCH] Wrap the main_db call in a transaction. --- modules/reporting/runstatistics.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/modules/reporting/runstatistics.py b/modules/reporting/runstatistics.py index 6f038abb..efd93329 100644 --- a/modules/reporting/runstatistics.py +++ b/modules/reporting/runstatistics.py @@ -101,7 +101,8 @@ def run(self, results): detail["anti_issues"], ) = self.getSignaturesAndAlertCount(results) detail["files_written"] = self.getFilesWrittenCount(results) - if main_db.add_statistics_to_task(task_id, detail): - log.debug("Run statistics sucessed!") - else: - log.debug("Run statistics failed!") + with main_db.session.begin(): + if main_db.add_statistics_to_task(task_id, detail): + log.debug("Run statistics succeeded!") + else: + log.debug("Run statistics failed!")