mirror of
https://github.com/dataease/dataease.git
synced 2026-05-15 13:32:18 +08:00
fix(X-Pack): 定时报告任务停止实例未停止
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
2
de-xpack
2
de-xpack
Submodule de-xpack updated: 16f95eb548...96a9aef239
Reference in New Issue
Block a user