Commit 1ab2e0d0 by huangfusuper

解决重复执行的BUG

parent 6cd48c0f
...@@ -82,7 +82,7 @@ public class RunNodeServiceImpl implements RunNodeServer, ApplicationEventPublis ...@@ -82,7 +82,7 @@ public class RunNodeServiceImpl implements RunNodeServer, ApplicationEventPublis
}else { }else {
jobTask.setTriggerTime(node.getTriggerNextTime()); jobTask.setTriggerTime(node.getTriggerNextTime());
try { try {
node.setTriggerNextTime(new CronExpression(node.getNodeCron()).getNextValidTimeAfter(new Date()).getTime()); node.setTriggerNextTime(new CronExpression(node.getNodeCron()).getNextValidTimeAfter(new Date(node.getTriggerNextTime())).getTime());
} catch (ParseException e) { } catch (ParseException e) {
e.printStackTrace(); e.printStackTrace();
} }
...@@ -101,7 +101,7 @@ public class RunNodeServiceImpl implements RunNodeServer, ApplicationEventPublis ...@@ -101,7 +101,7 @@ public class RunNodeServiceImpl implements RunNodeServer, ApplicationEventPublis
jobTaskService.saveJobTasks(jobTasks); jobTaskService.saveJobTasks(jobTasks);
log.info("-------------【开始修改工作流{}的下次运行时间,以及各种状态】---------------",flow); log.info("-------------【开始修改工作流{}的下次运行时间,以及各种状态】---------------",flow);
try { try {
flow.setTriggerNextTime(new CronExpression(flow.getFlowCron()).getNextValidTimeAfter(new Date()).getTime()); flow.setTriggerNextTime(new CronExpression(flow.getFlowCron()).getNextValidTimeAfter(new Date(flow.getTriggerNextTime())).getTime());
} catch (ParseException e) { } catch (ParseException e) {
flow.setTriggerNextTime(999999999999999999L); flow.setTriggerNextTime(999999999999999999L);
......
...@@ -39,7 +39,11 @@ public class TimeoutExampleThreadRunHelper extends BaseThreadRunHelper { ...@@ -39,7 +39,11 @@ public class TimeoutExampleThreadRunHelper extends BaseThreadRunHelper {
List<RunRecording> allRunIng = runRecordingService.findAllRunIng(new FlowConditionDto()); List<RunRecording> allRunIng = runRecordingService.findAllRunIng(new FlowConditionDto());
List<RunRecording> timeoutRunRecordings = allRunIng.stream().filter(runRecording -> { List<RunRecording> timeoutRunRecordings = allRunIng.stream().filter(runRecording -> {
long startTime = runRecording.getTriggerTime(); Date startDate = runRecording.getStartTime();
if(startDate == null){
return false;
}
long startTime = startDate.getTime();
long thisTime = System.currentTimeMillis(); long thisTime = System.currentTimeMillis();
Long flowTimeout = runRecording.getFlowTimeout(); Long flowTimeout = runRecording.getFlowTimeout();
long time = thisTime - startTime; long time = thisTime - startTime;
...@@ -47,10 +51,7 @@ public class TimeoutExampleThreadRunHelper extends BaseThreadRunHelper { ...@@ -47,10 +51,7 @@ public class TimeoutExampleThreadRunHelper extends BaseThreadRunHelper {
}).collect(Collectors.toList()); }).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(timeoutRunRecordings)){ if (CollectionUtil.isNotEmpty(timeoutRunRecordings)){
timeoutRunRecordings.forEach(timeoutRunRecording ->{ timeoutRunRecordings.forEach(runRecordingAndLogService::logAndRunRecordingFailFast);
runRecordingAndLogService.logAndRunRecordingFailFast(timeoutRunRecording);
});
} }
return TimeUnit.MINUTES.toMillis(5); return TimeUnit.MINUTES.toMillis(5);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment