Merge pull request #27255 from taosdata/fix/create_tb
fix(stream): check status before start timer.
This commit is contained in:
commit
06fea91b55
|
@ -762,6 +762,14 @@ int32_t streamDispatchStreamBlock(SStreamTask* pTask) {
|
|||
|
||||
code = sendDispatchMsg(pTask, pTask->msgInfo.pData);
|
||||
|
||||
// todo: secure the timerActive and start timer in after lock pTask->lock
|
||||
streamMutexLock(&pTask->lock);
|
||||
bool shouldStop = streamTaskShouldStop(pTask);
|
||||
streamMutexUnlock(&pTask->lock);
|
||||
|
||||
if (shouldStop) {
|
||||
stDebug("s-task:%s in stop/dropping status, not start dispatch monitor tmr", id);
|
||||
} else {
|
||||
streamMutexLock(&pTask->msgInfo.lock);
|
||||
if (pTask->msgInfo.inMonitor == 0) {
|
||||
int32_t ref = atomic_add_fetch_32(&pTask->status.timerActive, 1);
|
||||
|
@ -774,6 +782,7 @@ int32_t streamDispatchStreamBlock(SStreamTask* pTask) {
|
|||
}
|
||||
|
||||
streamMutexUnlock(&pTask->msgInfo.lock);
|
||||
}
|
||||
|
||||
// this block can not be deleted until it has been sent to downstream task successfully.
|
||||
return TSDB_CODE_SUCCESS;
|
||||
|
|
Loading…
Reference in New Issue