fix.修复任务失败死循环的问题

This commit is contained in:
MistEO
2021-12-22 21:40:03 +08:00
parent 3e9d268342
commit 31aa218bce
3 changed files with 4 additions and 3 deletions

View File

@@ -22,7 +22,7 @@ AbstractTask::AbstractTask(AsstCallback callback, void* callback_arg)
bool asst::AbstractTask::run()
{
for (int i = 0; i != m_retry_times; ++i) {
for (m_cur_retry = 0; m_cur_retry < m_retry_times; ++m_cur_retry) {
if (_run()) {
return true;
}

View File

@@ -41,6 +41,7 @@ namespace asst
void* m_callback_arg = NULL;
bool* m_exit_flag = NULL;
std::string m_task_chain;
int m_cur_retry = 0;
int m_retry_times = RetryTimesDefault;
};
}

View File

@@ -143,8 +143,8 @@ bool ProcessTask::_run()
} break;
default:
break;
}
m_retry_times = 0;
}
m_cur_retry = 0;
++exec_times;