ES异步同步数据
This commit is contained in:
-5
@@ -178,16 +178,11 @@ public class HomeSearchCheckEsPlanJob implements Job {
|
||||
endIndex = startIndex + batchCount;
|
||||
}
|
||||
List<String> ids = listIds.subList(startIndex, endIndex);
|
||||
// 异步生成记录
|
||||
ForkJoinPool pool = new ForkJoinPool();
|
||||
// 异步调用
|
||||
CompletableFuture.runAsync(() -> {
|
||||
try {
|
||||
lawsHomeSearchService.updateEsData(lawsNewsFeed, String.join(",", ids), LawsHomeSearchCommon.LAWS_ES_ADD);
|
||||
} catch (Exception e) {
|
||||
log.error("ES同步异常:", e.getMessage());
|
||||
}
|
||||
}, pool);
|
||||
startIndex = startIndex + batchCount; // 下一批
|
||||
}
|
||||
}
|
||||
|
||||
+3
@@ -842,6 +842,8 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
|
||||
throw new JeroBootException(ResultCommon.PARAMETER_NOT_RECOGNIZED);
|
||||
}
|
||||
log.info("================ES更新数据开始=================");
|
||||
ForkJoinPool pool = new ForkJoinPool();
|
||||
CompletableFuture.runAsync(()->{
|
||||
try{
|
||||
//判断索引是否存在
|
||||
boolean flagTemp;
|
||||
@@ -867,6 +869,7 @@ public class LawsHomeSearchServiceImpl implements ILawsHomeSearchService {
|
||||
}catch (Exception e){
|
||||
log.error("ES同步异常",e.getMessage());
|
||||
}
|
||||
},pool);
|
||||
log.info("================ES更新数据结束=================");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user