From 406fddb27b6df75213f3dc1bb06a7fd0beb55c18 Mon Sep 17 00:00:00 2001 From: Simon Quigley Date: Sun, 26 Jan 2025 23:40:58 -0600 Subject: [PATCH] Move to the database at the very end of a task --- cpp/task_queue.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cpp/task_queue.cpp b/cpp/task_queue.cpp index db61486..ea77596 100644 --- a/cpp/task_queue.cpp +++ b/cpp/task_queue.cpp @@ -164,7 +164,6 @@ void TaskQueue::worker_thread() { { // Remove the task from running_tasks_ - task_to_execute->save(0); std::lock_guard lock(running_tasks_mutex_); int id = task_to_execute->id; auto running_task_it = std::find_if(running_tasks_.begin(), running_tasks_.end(), @@ -186,5 +185,8 @@ void TaskQueue::worker_thread() { running_pkgconfs_.erase(running_pkgconf_it); } } + + // Save to the database at the end + task_to_execute->save(0); } }