Commit 1ab2e0d0 by huangfusuper

解决重复执行的BUG

parent 6cd48c0f
......@@ -82,7 +82,7 @@ public class RunNodeServiceImpl implements RunNodeServer, ApplicationEventPublis
}else {
jobTask.setTriggerTime(node.getTriggerNextTime());
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) {
e.printStackTrace();
}
......@@ -101,7 +101,7 @@ public class RunNodeServiceImpl implements RunNodeServer, ApplicationEventPublis
jobTaskService.saveJobTasks(jobTasks);
log.info("-------------【开始修改工作流{}的下次运行时间,以及各种状态】---------------",flow);
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) {
flow.setTriggerNextTime(999999999999999999L);
......
......@@ -39,7 +39,11 @@ public class TimeoutExampleThreadRunHelper extends BaseThreadRunHelper {
List<RunRecording> allRunIng = runRecordingService.findAllRunIng(new FlowConditionDto());
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 flowTimeout = runRecording.getFlowTimeout();
long time = thisTime - startTime;
......@@ -47,10 +51,7 @@ public class TimeoutExampleThreadRunHelper extends BaseThreadRunHelper {
}).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(timeoutRunRecordings)){
timeoutRunRecordings.forEach(timeoutRunRecording ->{
runRecordingAndLogService.logAndRunRecordingFailFast(timeoutRunRecording);
});
timeoutRunRecordings.forEach(runRecordingAndLogService::logAndRunRecordingFailFast);
}
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