fix: 修复工作流实例 DAG 中节点信息未同步的问题

This commit is contained in:
Echo009 2021-02-18 16:53:28 +08:00
parent 6671bcf6f7
commit 9748190a8a

View File

@ -291,6 +291,8 @@ public class WorkflowInstanceManager {
}
// 注意这里会直接跳过 disable 的节点
List<PEWorkflowDAG.Node> readyNodes = WorkflowDAGUtils.listReadyNodes(dag);
// 这里得重新更新一下因为 WorkflowDAGUtils#listReadyNodes 可能会更新节点状态
wfInstance.setDag(JSON.toJSONString(dag));
// 如果没有就绪的节点需要再次判断是否已经全部完成
if (readyNodes.isEmpty() && isFinish(dag)) {
allFinished = true;
@ -315,7 +317,7 @@ public class WorkflowInstanceManager {
readyNode.setStatus(InstanceStatus.RUNNING.getV());
log.debug("[Workflow-{}|{}] workflowInstance start to process new node(nodeId={},jobId={},instanceId={})", wfId, wfInstanceId, readyNode.getNodeId(), readyNode.getJobId(), newInstanceId);
}
// 这里也得更新 DAG 信息
wfInstance.setDag(JSON.toJSONString(dag));
workflowInstanceInfoRepository.saveAndFlush(wfInstance);
// 持久化结束后开始调度执行所有的任务