diff --git a/core/core-backend/src/main/java/io/dataease/job/schedule/DeTaskExecutor.java b/core/core-backend/src/main/java/io/dataease/job/schedule/DeTaskExecutor.java index bb10e7e004..819be4a98e 100644 --- a/core/core-backend/src/main/java/io/dataease/job/schedule/DeTaskExecutor.java +++ b/core/core-backend/src/main/java/io/dataease/job/schedule/DeTaskExecutor.java @@ -29,7 +29,8 @@ public class DeTaskExecutor { } @XpackInteract(value = "xpackTaskExecutor", replace = true) - public void init() {} + public void init() { + } public void addOrUpdateTask(Long taskId, String cron, Long startTime, Long endTime) { if (CronUtils.taskExpire(endTime)) { @@ -46,10 +47,14 @@ public class DeTaskExecutor { scheduleManager.addOrUpdateCronJob(jobKey, triggerKey, DeXpackScheduleJob.class, cron, new Date(startTime), end, jobDataMap); } - public void fireNow(Long taskId) throws Exception { + public boolean fireNow(Long taskId) throws Exception { String key = taskId.toString(); JobKey jobKey = new JobKey(key, JOB_GROUP); - scheduleManager.fireNow(jobKey); + if (scheduleManager.exist(jobKey)) { + scheduleManager.fireNow(jobKey); + return true; + } + return false; } public void addTempTask(Long taskId, Long startTime) { diff --git a/core/core-backend/src/main/java/io/dataease/job/schedule/ScheduleManager.java b/core/core-backend/src/main/java/io/dataease/job/schedule/ScheduleManager.java index 6691644506..5534f0f614 100644 --- a/core/core-backend/src/main/java/io/dataease/job/schedule/ScheduleManager.java +++ b/core/core-backend/src/main/java/io/dataease/job/schedule/ScheduleManager.java @@ -431,4 +431,13 @@ public class ScheduleManager { scheduler.triggerJob(jobKey); } + public boolean exist(JobKey jobKey) { + try { + return scheduler.checkExists(jobKey); + } catch (SchedulerException e) { + LogUtil.error(e.getMessage(), new Throwable(e)); + return false; + } + } + } diff --git a/de-xpack b/de-xpack index 16f95eb548..96a9aef239 160000 --- a/de-xpack +++ b/de-xpack @@ -1 +1 @@ -Subproject commit 16f95eb5481cda834434b2c6f956b66a411ad67b +Subproject commit 96a9aef239d74efa6d6e7c3780d42409b065ae2a