Merge pull request #11040 from dataease/pr@dev-v2@perf_report_retry_error

perf(X-Pack): 定时报告失败重试无效
This commit is contained in:
fit2cloud-chenyw 2024-07-19 13:14:02 +08:00 committed by GitHub
commit 89ee108ba8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 5 additions and 7 deletions

View File

@ -51,12 +51,11 @@ public class DeTaskExecutor {
public void addRetryTask(Long taskId, Integer retryLimit, Integer retryInterval) {
long saltTime = 3000L;
long interval = retryInterval == null ? 0L : retryInterval;
long interval = retryInterval == null ? 5L : retryInterval;
long intervalMill = interval * 60000L;
long now = System.currentTimeMillis();
long startTime = now - saltTime + intervalMill;
String cron = "0 */" + retryInterval + " * * * ?";
long endTime = (retryLimit - 1) * intervalMill + startTime + saltTime;
String cron = "0 */" + interval + " * * * ?";
long endTime = (retryLimit + 1) * intervalMill + now - saltTime;
String key = taskId.toString();
if (CronUtils.taskExpire(endTime)) {
return;
@ -68,7 +67,7 @@ public class DeTaskExecutor {
jobDataMap.put(IS_RETRY_TASK, true);
Date end = null;
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 {

View File

@ -21,7 +21,6 @@ public class XpackTaskStarter implements ApplicationRunner {
try {
LicenseUtil.validate();
deTaskExecutor.init();
deTaskExecutor.clearRetryTask();
} catch (Exception e) {
LogUtil.error(e.getMessage(), e.getCause());
}

@ -1 +1 @@
Subproject commit e8581cf0aede767c0ea8fdfbc16058847a8f197b
Subproject commit 141a8a003f3a3eea6a9a5ceae06f15c7b0ecf04e