Skip to content

Commit

Permalink
[Bug] [Fix-10672] Dependent task retry bug (#10707)
Browse files Browse the repository at this point in the history
* fix 10517

* fix dep warn bug

Co-authored-by: JinyLeeChina <jiny.li@foxmail.com>
  • Loading branch information
brave-lee and JinyLeeChina committed Jul 1, 2022
1 parent 1f7a328 commit 3c20fe7
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -348,13 +348,17 @@ private boolean taskTimeout(StateEvent stateEvent) {
return true;
}
TaskTimeoutStrategy taskTimeoutStrategy = taskInstance.getTaskDefine().getTimeoutNotifyStrategy();
if (TaskTimeoutStrategy.FAILED == taskTimeoutStrategy && !taskInstance.getState().typeIsFinished()) {
if ((TaskTimeoutStrategy.FAILED == taskTimeoutStrategy || TaskTimeoutStrategy.WARNFAILED == taskTimeoutStrategy) && !taskInstance.getState().typeIsFinished()) {
ITaskProcessor taskProcessor = activeTaskProcessorMaps.get(stateEvent.getTaskInstanceId());
taskProcessor.action(TaskAction.TIMEOUT);
if (taskInstance.isDependTask()) {
TaskInstance task = processService.findTaskInstanceById(taskInstance.getId());
taskFinished(task);
}
if (TaskTimeoutStrategy.WARNFAILED == taskTimeoutStrategy) {
ProjectUser projectUser = processService.queryProjectWithUserByProcessInstanceId(processInstance.getId());
processAlertManager.sendTaskTimeoutAlert(processInstance, taskInstance, projectUser);
}
} else {
ProjectUser projectUser = processService.queryProjectWithUserByProcessInstanceId(processInstance.getId());
processAlertManager.sendTaskTimeoutAlert(processInstance, taskInstance, projectUser);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,12 @@ private DependResult getDependTaskResult(long taskCode, DateInterval dateInterva
TaskInstance taskInstance = processService.findLastTaskInstanceInterval(taskCode, dateInterval);
DependResult result;
if (taskInstance == null) {
logger.warn("Cannot find the task in the process instance when the ProcessInstance is finish, taskCode: {}", taskCode);
TaskDefinition taskDefinition = processService.findTaskDefinitionByCode(taskCode);
if (taskDefinition == null) {
logger.error("Cannot find the task definition, something error, taskCode: {}", taskCode);
} else {
logger.warn("Cannot find the task in the process instance when the ProcessInstance is finish, taskCode: {}, taskName: {}", taskCode, taskDefinition.getName());
}
result = DependResult.FAILED;
} else {
logger.info("The running task, taskId:{}, taskCode:{}, taskName:{}", taskInstance.getId(), taskInstance.getTaskCode(), taskInstance.getName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2489,6 +2489,13 @@ public TaskDefinition findTaskDefinition(long taskCode, int taskDefinitionVersio
return taskDefinitionLogMapper.queryByDefinitionCodeAndVersion(taskCode, taskDefinitionVersion);
}

/**
* find task definition by code
*/
public TaskDefinition findTaskDefinitionByCode(long taskCode) {
return taskDefinitionMapper.queryByCode(taskCode);
}

/**
* find process task relation list by process
*/
Expand Down

0 comments on commit 3c20fe7

Please sign in to comment.