fix: missing workflow instance result and finished time

This commit is contained in:
Echo009 2021-02-26 09:54:02 +08:00
parent 6d5225beab
commit 79b30f882d
2 changed files with 8 additions and 1 deletions

View File

@ -46,6 +46,10 @@ public class SystemInstanceResult {
public static final String MIDDLE_JOB_STOPPED = "middle job stopped by user"; public static final String MIDDLE_JOB_STOPPED = "middle job stopped by user";
public static final String CAN_NOT_FIND_JOB = "can't find some job"; public static final String CAN_NOT_FIND_JOB = "can't find some job";
/**
* 没有启用的节点
*/
public static final String NO_ENABLED_NODES = "no enabled nodes";
/** /**
* 被用户手动停止 * 被用户手动停止
*/ */

View File

@ -20,7 +20,8 @@ import com.github.kfcfans.powerjob.server.service.alarm.WorkflowInstanceAlarm;
import com.github.kfcfans.powerjob.server.service.id.IdGenerateService; import com.github.kfcfans.powerjob.server.service.id.IdGenerateService;
import com.github.kfcfans.powerjob.server.service.instance.InstanceService; import com.github.kfcfans.powerjob.server.service.instance.InstanceService;
import com.github.kfcfans.powerjob.server.service.lock.local.UseSegmentLock; import com.github.kfcfans.powerjob.server.service.lock.local.UseSegmentLock;
import com.google.common.collect.*; import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
@ -191,6 +192,8 @@ public class WorkflowInstanceManager {
if (readyNodes.isEmpty()) { if (readyNodes.isEmpty()) {
// 没有就绪的节点所有节点都被禁用 // 没有就绪的节点所有节点都被禁用
wfInstanceInfo.setStatus(WorkflowInstanceStatus.SUCCEED.getV()); wfInstanceInfo.setStatus(WorkflowInstanceStatus.SUCCEED.getV());
wfInstanceInfo.setResult(SystemInstanceResult.NO_ENABLED_NODES);
wfInstanceInfo.setFinishedTime(System.currentTimeMillis());
log.warn("[Workflow-{}|{}] workflowInstance({}) needn't running ", wfInfo.getId(), wfInstanceId, wfInstanceInfo); log.warn("[Workflow-{}|{}] workflowInstance({}) needn't running ", wfInfo.getId(), wfInstanceId, wfInstanceInfo);
workflowInstanceInfoRepository.saveAndFlush(wfInstanceInfo); workflowInstanceInfoRepository.saveAndFlush(wfInstanceInfo);
return; return;