diff --git a/xxl-job-admin/src/main/java/com/xxl/job/admin/core/thread/JobScheduleHelper.java b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/thread/JobScheduleHelper.java index 8e451c53d56f602c9a783bb211824268ef1a08ce..817d02bd06ae362bec6ea6f3eb35a669181958b2 100644 --- a/xxl-job-admin/src/main/java/com/xxl/job/admin/core/thread/JobScheduleHelper.java +++ b/xxl-job-admin/src/main/java/com/xxl/job/admin/core/thread/JobScheduleHelper.java @@ -88,20 +88,15 @@ public class JobScheduleHelper { } else if (nowTime > jobInfo.getTriggerNextTime()) { // 2.2、trigger-expire < 5s:direct-trigger && make next-trigger-time - CronExpression cronExpression = new CronExpression(jobInfo.getJobCron()); - long nextTime = cronExpression.getNextValidTimeAfter(new Date()).getTime(); - // 1、trigger JobTriggerPoolHelper.trigger(jobInfo.getId(), TriggerTypeEnum.CRON, -1, null, null); logger.debug(">>>>>>>>>>> xxl-job, shecule push trigger : jobId = " + jobInfo.getId() ); // 2、fresh next - jobInfo.setTriggerLastTime(jobInfo.getTriggerNextTime()); - jobInfo.setTriggerNextTime(nextTime); - + refreshNextValidTime(jobInfo, new Date(jobInfo.getTriggerNextTime())); // next-trigger-time in 5s, pre-read again - if (jobInfo.getTriggerNextTime() - nowTime < PRE_READ_MS) { + if (jobInfo.getTriggerStatus()==1 && nowTime + PRE_READ_MS > jobInfo.getTriggerNextTime()) { // 1、make ring second int ringSecond = (int)((jobInfo.getTriggerNextTime()/1000)%60); diff --git a/xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobInfoMapper.xml b/xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobInfoMapper.xml index 0407011af446a925d50d1b4b98eea44c03dc6ac7..058ff71fa5688d5bb42502b909972ed9d63c9a9c 100644 --- a/xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobInfoMapper.xml +++ b/xxl-job-admin/src/main/resources/mybatis-mapper/XxlJobInfoMapper.xml @@ -212,7 +212,7 @@ SELECT FROM xxl_job_info AS t WHERE t.trigger_status = 1 - and t.trigger_next_time #{maxNextTime} + and t.trigger_next_time #{maxNextTime}