fix: 修复手动终止任务时有概率出现的“任务出错”

This commit is contained in:
Zhi Qi
2022-10-16 07:59:26 +08:00
parent 6ab371a7da
commit 8bb4f64ae2

View File

@@ -263,7 +263,9 @@ void Assistant::working_proc()
}
lock.unlock();
task_callback(ret ? AsstMsg::TaskChainCompleted : AsstMsg::TaskChainError, callback_json, this);
// We don't consider a task failed when user stop it.
auto msg = ret || m_thread_idle ? AsstMsg::TaskChainSuccess : AsstMsg::TaskChainFailed;
task_callback(msg, callback_json, this);
if (!m_thread_idle && m_tasks_list.empty()) {
callback_json["finished_tasks"] = json::array(finished_tasks);