refactor: 定时任务使用一个线程同步执行
This commit is contained in:
parent
7c0cab89af
commit
841a85a4c9
|
@ -57,14 +57,7 @@ public class CleanHistoryJob {
|
|||
int size = 100;
|
||||
List<List<String>> batchList = splitList(sourceIds, size);
|
||||
|
||||
batchList.forEach(batch -> {
|
||||
Thread.startVirtualThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
cleanupHistory(batch, limit);
|
||||
}
|
||||
});
|
||||
});
|
||||
batchList.forEach(batch -> cleanupHistory(batch, limit));
|
||||
}
|
||||
|
||||
private List<List<String>> splitList(List<String> list, int size) {
|
||||
|
|
|
@ -49,10 +49,7 @@ public class CleanUpReportJob {
|
|||
|
||||
for (int i = 0; i < pages; i++) {
|
||||
int start = i * 100;
|
||||
Thread.startVirtualThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
List<Project> projects = baseProjectMapper.selectProjectByLimit(start,100);
|
||||
List<Project> projects = baseProjectMapper.selectProjectByLimit(start, 100);
|
||||
projects.forEach(project -> {
|
||||
ProjectApplicationExample applicationExample = new ProjectApplicationExample();
|
||||
//test_plan
|
||||
|
@ -101,8 +98,7 @@ public class CleanUpReportJob {
|
|||
});
|
||||
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue