From 9c78f400dc55c0c4aede2d43dc60d749e34f4f3d Mon Sep 17 00:00:00 2001 From: xiongxiaoyang Date: Thu, 21 May 2020 09:15:47 +0800 Subject: [PATCH] =?UTF-8?q?v2.1.0=E5=8F=91=E5=B8=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/java2nb/novel/core/schedule/BookToEsSchedule.java | 6 ++++-- .../novel/core/schedule/Network2LocalPicSchedule.java | 4 ++++ 2 files changed, 8 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 5fcce43..46e31f9 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 @@ -43,9 +43,9 @@ public class BookToEsSchedule { private boolean lock = false; /** - * 1分钟导入一次 + * 2分钟导入一次 */ - @Scheduled(fixedRate = 1000 * 60) + @Scheduled(fixedRate = 1000 * 60 * 2) public void saveToEs() { if (!lock) { lock = true; @@ -70,6 +70,8 @@ public class BookToEsSchedule { jestClient.execute(action); lastDate = book.getUpdateTime(); + //1秒钟导入一本书,1分钟导入60本 + Thread.sleep(1000); } diff --git a/novel-front/src/main/java/com/java2nb/novel/core/schedule/Network2LocalPicSchedule.java b/novel-front/src/main/java/com/java2nb/novel/core/schedule/Network2LocalPicSchedule.java index ef2edfd..17a9e87 100644 --- a/novel-front/src/main/java/com/java2nb/novel/core/schedule/Network2LocalPicSchedule.java +++ b/novel-front/src/main/java/com/java2nb/novel/core/schedule/Network2LocalPicSchedule.java @@ -3,6 +3,7 @@ package com.java2nb.novel.core.schedule; import com.java2nb.novel.entity.Book; import com.java2nb.novel.service.BookService; import lombok.RequiredArgsConstructor; +import lombok.SneakyThrows; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Value; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; @@ -34,6 +35,7 @@ public class Network2LocalPicSchedule { * 10分钟转一次 */ @Scheduled(fixedRate = 1000 * 60 * 10) + @SneakyThrows public void trans() { log.info("Network2LocalPicSchedule。。。。。。。。。。。。"); @@ -42,6 +44,8 @@ public class Network2LocalPicSchedule { List networkPicBooks = bookService.queryNetworkPicBooks(100); for (Book book : networkPicBooks) { bookService.updateBookPicToLocal(book.getPicUrl(), book.getId()); + //3秒钟转化一张图片,10分钟转化200张 + Thread.sleep(3000); }