forked from github/dataease
perf(X-Pack): 定时报告失败重试无效
This commit is contained in:
parent
155408e017
commit
098bc2fd82
@ -51,12 +51,11 @@ public class DeTaskExecutor {
|
|||||||
|
|
||||||
public void addRetryTask(Long taskId, Integer retryLimit, Integer retryInterval) {
|
public void addRetryTask(Long taskId, Integer retryLimit, Integer retryInterval) {
|
||||||
long saltTime = 3000L;
|
long saltTime = 3000L;
|
||||||
long interval = retryInterval == null ? 0L : retryInterval;
|
long interval = retryInterval == null ? 5L : retryInterval;
|
||||||
long intervalMill = interval * 60000L;
|
long intervalMill = interval * 60000L;
|
||||||
long now = System.currentTimeMillis();
|
long now = System.currentTimeMillis();
|
||||||
long startTime = now - saltTime + intervalMill;
|
String cron = "0 */" + interval + " * * * ?";
|
||||||
String cron = "0 */" + retryInterval + " * * * ?";
|
long endTime = (retryLimit + 1) * intervalMill + now - saltTime;
|
||||||
long endTime = (retryLimit - 1) * intervalMill + startTime + saltTime;
|
|
||||||
String key = taskId.toString();
|
String key = taskId.toString();
|
||||||
if (CronUtils.taskExpire(endTime)) {
|
if (CronUtils.taskExpire(endTime)) {
|
||||||
return;
|
return;
|
||||||
@ -68,7 +67,7 @@ public class DeTaskExecutor {
|
|||||||
jobDataMap.put(IS_RETRY_TASK, true);
|
jobDataMap.put(IS_RETRY_TASK, true);
|
||||||
Date end = null;
|
Date end = null;
|
||||||
if (ObjectUtils.isNotEmpty(endTime)) end = new Date(endTime);
|
if (ObjectUtils.isNotEmpty(endTime)) end = new Date(endTime);
|
||||||
scheduleManager.addOrUpdateCronJob(jobKey, triggerKey, DeXpackScheduleJob.class, cron, new Date(startTime), end, jobDataMap);
|
scheduleManager.addOrUpdateCronJob(jobKey, triggerKey, DeXpackScheduleJob.class, cron, new Date(now), end, jobDataMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean fireNow(Long taskId) throws Exception {
|
public boolean fireNow(Long taskId) throws Exception {
|
||||||
|
@ -21,7 +21,6 @@ public class XpackTaskStarter implements ApplicationRunner {
|
|||||||
try {
|
try {
|
||||||
LicenseUtil.validate();
|
LicenseUtil.validate();
|
||||||
deTaskExecutor.init();
|
deTaskExecutor.init();
|
||||||
deTaskExecutor.clearRetryTask();
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
LogUtil.error(e.getMessage(), e.getCause());
|
LogUtil.error(e.getMessage(), e.getCause());
|
||||||
}
|
}
|
||||||
|
2
de-xpack
2
de-xpack
@ -1 +1 @@
|
|||||||
Subproject commit e8581cf0aede767c0ea8fdfbc16058847a8f197b
|
Subproject commit 141a8a003f3a3eea6a9a5ceae06f15c7b0ecf04e
|
Loading…
Reference in New Issue
Block a user