fix(stream): update the check order.
This commit is contained in:
parent
2ecc202cb3
commit
49bc3924fb
|
@ -776,21 +776,13 @@ int32_t streamResumeTask(SStreamTask* pTask) {
|
|||
const char* id = pTask->id.idStr;
|
||||
|
||||
while (1) {
|
||||
/*int32_t code = */doStreamExecTask(pTask);
|
||||
/*int32_t code = */ doStreamExecTask(pTask);
|
||||
taosThreadMutexLock(&pTask->lock);
|
||||
|
||||
// check if this task needs to be idle for a while
|
||||
if (pTask->status.schedIdleTime > 0) {
|
||||
schedTaskInFuture(pTask);
|
||||
|
||||
taosThreadMutexUnlock(&pTask->lock);
|
||||
setLastExecTs(pTask, taosGetTimestampMs());
|
||||
return 0;
|
||||
} else {
|
||||
int32_t numOfItems = streamQueueGetNumOfItems(pTask->inputq.queue);
|
||||
|
||||
if ((numOfItems == 0) || streamTaskShouldStop(pTask) || streamTaskShouldPause(pTask)) {
|
||||
atomic_store_8(&pTask->status.schedStatus, TASK_SCHED_STATUS__INACTIVE);
|
||||
clearTaskSchedInfo(pTask);
|
||||
taosThreadMutexUnlock(&pTask->lock);
|
||||
|
||||
setLastExecTs(pTask, taosGetTimestampMs());
|
||||
|
@ -800,6 +792,14 @@ int32_t streamResumeTask(SStreamTask* pTask) {
|
|||
pTask->status.schedStatus, pTask->status.lastExecTs);
|
||||
|
||||
return 0;
|
||||
} else {
|
||||
// check if this task needs to be idle for a while
|
||||
if (pTask->status.schedIdleTime > 0) {
|
||||
schedTaskInFuture(pTask);
|
||||
|
||||
taosThreadMutexUnlock(&pTask->lock);
|
||||
setLastExecTs(pTask, taosGetTimestampMs());
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue