1 修改规则引擎下规则和定时任务再系统重启后加载失败的问题

V0.5.x
lijio_o@foxmail.com 2022-09-21 10:51:20 +08:00
parent 20f845f0e4
commit 12addc0143
2 changed files with 10 additions and 8 deletions

View File

@ -60,9 +60,13 @@ public class RuleManager {
@SneakyThrows @SneakyThrows
public void initRules() { public void initRules() {
int idx = 0; int idx = 1;
while (true) { while (true) {
Paging<RuleInfo> rules = ruleInfoData.findAll(idx, 1000); Paging<RuleInfo> rules = ruleInfoData.findAll(idx, 1000);
// 如果记录为空,直接跳出循环
if (rules.getData() == null || rules.getData().isEmpty()) {
break;
}
rules.getData().forEach(rule -> { rules.getData().forEach(rule -> {
try { try {
//不添加停止的规则 //不添加停止的规则
@ -76,9 +80,6 @@ public class RuleManager {
} }
}); });
idx++; idx++;
if (rules.getTotal() == 0) {
break;
}
} }
} }

View File

@ -48,9 +48,13 @@ public class TaskManager implements ApplicationContextAware {
} }
public void initTask() { public void initTask() {
int idx = 0; int idx = 1;
while (true) { while (true) {
Paging<TaskInfo> tasks = taskInfoData.findAll(idx, 1000); Paging<TaskInfo> tasks = taskInfoData.findAll(idx, 1000);
// 如果记录为空,直接跳出循环
if (tasks.getData() == null || tasks.getData().isEmpty()) {
break;
}
tasks.getData().forEach(task -> { tasks.getData().forEach(task -> {
try { try {
if (!TaskInfo.STATE_RUNNING.equals(task.getState())) { if (!TaskInfo.STATE_RUNNING.equals(task.getState())) {
@ -63,9 +67,6 @@ public class TaskManager implements ApplicationContextAware {
} }
}); });
idx++; idx++;
if (tasks.getTotal() == 0) {
break;
}
} }
} }