Skip to content

Commit

Permalink
Fix delay execution task will never be dispatched (#15751)
Browse files Browse the repository at this point in the history
Co-authored-by: Eric Gao <ericgao.apache@gmail.com>
  • Loading branch information
ruanwenjun and EricGao888 committed Mar 22, 2024
1 parent 99a2461 commit 2e16907
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Expand Up @@ -69,7 +69,7 @@ public void run() {
defaultTaskExecuteRunnable = globalTaskDispatchWaitingQueue.takeTaskExecuteRunnable();
try {
TaskExecutionStatus status = defaultTaskExecuteRunnable.getTaskInstance().getState();
if (status != TaskExecutionStatus.SUBMITTED_SUCCESS) {
if (status != TaskExecutionStatus.SUBMITTED_SUCCESS && status != TaskExecutionStatus.DELAY_EXECUTION) {
log.warn("The TaskInstance {} state is : {}, will not dispatch",
defaultTaskExecuteRunnable.getTaskInstance().getName(), status);
continue;
Expand Down
Expand Up @@ -48,9 +48,10 @@ public void operate(DefaultTaskExecuteRunnable taskExecuteRunnable) {
if (remainTime > 0) {
taskInstance.setState(TaskExecutionStatus.DELAY_EXECUTION);
taskInstanceDao.updateById(taskInstance);
log.info("Current taskInstance: {} is choose delay execution, delay time: {}/s, remainTime: {}/s",
log.info("Current taskInstance: {} is choose delay execution, delay time: {}/min, remainTime: {}/s",
taskInstance.getName(),
taskInstance.getDelayTime(), remainTime);
taskInstance.getDelayTime(),
remainTime);
}
globalTaskDispatchWaitingQueue.submitTaskExecuteRunnable(taskExecuteRunnable);
}
Expand Down

0 comments on commit 2e16907

Please sign in to comment.