mirror of
https://github.com/201206030/novel-plus.git
synced 2025-04-27 01:30:51 +00:00
es采集优化
This commit is contained in:
parent
9b9851e7ab
commit
8f1ed88b07
@ -49,7 +49,7 @@ public class BookToEsSchedule {
|
||||
@Scheduled(fixedRate = 1000 * 60)
|
||||
public void saveToEs() {
|
||||
if (cacheService.get(CacheKey.ES_TRANS_LOCK) == null) {
|
||||
cacheService.set(CacheKey.ES_TRANS_LOCK, "1", 60 * 5);
|
||||
cacheService.set(CacheKey.ES_TRANS_LOCK, "1", 60 * 20);
|
||||
try {
|
||||
//查询需要更新的小说
|
||||
Date lastDate = (Date) cacheService.getObject(CacheKey.ES_LAST_UPDATE_TIME);
|
||||
@ -62,7 +62,7 @@ public class BookToEsSchedule {
|
||||
for (Book book : books) {
|
||||
searchService.importToEs(book);
|
||||
lastDate = book.getUpdateTime();
|
||||
Thread.sleep(1000);
|
||||
Thread.sleep(5000);
|
||||
|
||||
}
|
||||
|
||||
|
@ -16,5 +16,12 @@ public interface SearchService {
|
||||
*/
|
||||
void importToEs(Book book);
|
||||
|
||||
/**
|
||||
* 搜索
|
||||
* @param params 搜索参数
|
||||
* @param page 当前页码
|
||||
* @param pageSize 每页大小
|
||||
* @return 分页信息
|
||||
*/
|
||||
PageInfo searchBook(BookSP params, int page, int pageSize);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user