Merge pull request #2332 from LittleFall/fix/stop-not-fail

fix: 修复手动终止任务时有概率出现的“任务出错”
This commit is contained in:
MistEO
2022-10-18 00:24:53 +08:00
committed by GitHub

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::TaskChainCompleted : AsstMsg::TaskChainError;
task_callback(msg, callback_json, this);
if (!m_thread_idle && m_tasks_list.empty()) {
callback_json["finished_tasks"] = json::array(finished_tasks);