fixed task completeness was not checked before upload
This commit is contained in:
parent
e85ce57b82
commit
a5a989b359
2 changed files with 8 additions and 7 deletions
|
|
@ -46,7 +46,7 @@ class Worker {
|
|||
private:
|
||||
|
||||
void thread_run();
|
||||
void perform_task(std::unique_ptr<Task>& task, bool& success);
|
||||
bool perform_task(std::unique_ptr<Task>& task);
|
||||
|
||||
std::unique_ptr<std::thread> worker_thread;
|
||||
std::atomic<db::uuid_t> current_task;
|
||||
|
|
|
|||
|
|
@ -60,17 +60,18 @@ void Worker::thread_run() {
|
|||
if (queue_empty) continue;
|
||||
|
||||
// everything is good, perform the given task
|
||||
bool success;
|
||||
this->perform_task(task, success);
|
||||
bool complete = this->perform_task(task);
|
||||
|
||||
// if everything worked, push the task to be uploaded
|
||||
this->interface.push_finished(std::move(task));
|
||||
// if the task was finished, push the task to be uploaded
|
||||
// we need this since the task might have been interrupted
|
||||
// half way though
|
||||
if (complete) this->interface.push_finished(std::move(task));
|
||||
}
|
||||
}
|
||||
|
||||
void Worker::perform_task(std::unique_ptr<Task>& task, bool& success) {
|
||||
bool Worker::perform_task(std::unique_ptr<Task>& task) {
|
||||
std::cout << "Worker ping" << std::endl;
|
||||
usleep(100000);
|
||||
success = true;
|
||||
task->get_uuid();
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue