Only sync the task once per run in the task queue
This commit is contained in:
parent
9a35473d37
commit
91fb6f2548
@ -139,7 +139,6 @@ void TaskQueue::worker_thread() {
|
|||||||
std::chrono::system_clock::now().time_since_epoch())
|
std::chrono::system_clock::now().time_since_epoch())
|
||||||
.count();
|
.count();
|
||||||
task_to_execute->start_time = now;
|
task_to_execute->start_time = now;
|
||||||
task_to_execute->save(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -161,11 +160,11 @@ void TaskQueue::worker_thread() {
|
|||||||
std::chrono::system_clock::now().time_since_epoch())
|
std::chrono::system_clock::now().time_since_epoch())
|
||||||
.count();
|
.count();
|
||||||
task_to_execute->finish_time = now;
|
task_to_execute->finish_time = now;
|
||||||
task_to_execute->save(0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
// Remove the task from running_tasks_
|
// Remove the task from running_tasks_
|
||||||
|
task_to_execute->save(0);
|
||||||
std::lock_guard<std::mutex> lock(running_tasks_mutex_);
|
std::lock_guard<std::mutex> lock(running_tasks_mutex_);
|
||||||
int id = task_to_execute->id;
|
int id = task_to_execute->id;
|
||||||
auto running_task_it = std::find_if(running_tasks_.begin(), running_tasks_.end(),
|
auto running_task_it = std::find_if(running_tasks_.begin(), running_tasks_.end(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user