From 8f1ed88b07788644008b64fd87a697f02d80db61 Mon Sep 17 00:00:00 2001 From: xxy <773861846@qq.com> Date: Mon, 25 May 2020 23:38:46 +0800 Subject: [PATCH] =?UTF-8?q?es=E9=87=87=E9=9B=86=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/java2nb/novel/core/schedule/BookToEsSchedule.java | 4 ++-- .../main/java/com/java2nb/novel/service/SearchService.java | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/novel-front/src/main/java/com/java2nb/novel/core/schedule/BookToEsSchedule.java b/novel-front/src/main/java/com/java2nb/novel/core/schedule/BookToEsSchedule.java index d2dcda5..1da9ca7 100644 --- a/novel-front/src/main/java/com/java2nb/novel/core/schedule/BookToEsSchedule.java +++ b/novel-front/src/main/java/com/java2nb/novel/core/schedule/BookToEsSchedule.java @@ -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); } diff --git a/novel-front/src/main/java/com/java2nb/novel/service/SearchService.java b/novel-front/src/main/java/com/java2nb/novel/service/SearchService.java index e3c0dd4..381315c 100644 --- a/novel-front/src/main/java/com/java2nb/novel/service/SearchService.java +++ b/novel-front/src/main/java/com/java2nb/novel/service/SearchService.java @@ -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); }