[fix] fix the bug of can't stop workflow instance

This commit is contained in:
tjq 2020-07-19 23:36:55 +08:00
parent 7a6b8c0a0c
commit eb9dc8f2ed

View File

@ -48,6 +48,7 @@ public class WorkflowInstanceService {
// 停止所有已启动且未完成的服务
PEWorkflowDAG workflowDAG = JSONObject.parseObject(wfInstance.getDag(), PEWorkflowDAG.class);
WorkflowDAGUtils.listRoots(workflowDAG).forEach(node -> {
try {
if (node.getInstanceId() != null && InstanceStatus.generalizedRunningStatus.contains(node.getStatus())) {
log.debug("[WfInstance-{}] instance({}) is running, try to stop it now.", wfInstanceId, node.getInstanceId());
node.setStatus(InstanceStatus.STOPPED.getV());
@ -55,6 +56,9 @@ public class WorkflowInstanceService {
instanceService.stopInstance(node.getInstanceId());
}
}catch (Exception e) {
log.warn("[WfInstance-{}] stop instance({}) failed.", wfInstanceId, JSONObject.toJSONString(node), e);
}
});
// 修改数据库状态