|
@@ -73,6 +73,7 @@ import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.dao.DuplicateKeyException;
|
|
import org.springframework.dao.DuplicateKeyException;
|
|
|
import org.springframework.data.domain.Page;
|
|
import org.springframework.data.domain.Page;
|
|
|
import org.springframework.data.domain.PageRequest;
|
|
import org.springframework.data.domain.PageRequest;
|
|
|
|
|
+import org.springframework.data.domain.Sort;
|
|
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
import org.springframework.scheduling.annotation.Scheduled;
|
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
@@ -841,7 +842,7 @@ public class XxlJobService {
|
|
|
public ReturnT<String> refreshArticleHisCache(String param) {
|
|
public ReturnT<String> refreshArticleHisCache(String param) {
|
|
|
// 刷新历史表现缓存
|
|
// 刷新历史表现缓存
|
|
|
long count = articleTitleHisCacheRepository.count();
|
|
long count = articleTitleHisCacheRepository.count();
|
|
|
- int pageSize = 500;
|
|
|
|
|
|
|
+ int pageSize = 1000;
|
|
|
long page = (count / pageSize) + 1;
|
|
long page = (count / pageSize) + 1;
|
|
|
for (int i = 0; i < page; i++) {
|
|
for (int i = 0; i < page; i++) {
|
|
|
batchRefreshArticleHisCache(i, pageSize);
|
|
batchRefreshArticleHisCache(i, pageSize);
|
|
@@ -851,7 +852,7 @@ public class XxlJobService {
|
|
|
|
|
|
|
|
private void batchRefreshArticleHisCache(int i, int pageSize) {
|
|
private void batchRefreshArticleHisCache(int i, int pageSize) {
|
|
|
Page<ArticleTitleHisCache> articleTitleHisCachePage = articleTitleHisCacheRepository.findAll(
|
|
Page<ArticleTitleHisCache> articleTitleHisCachePage = articleTitleHisCacheRepository.findAll(
|
|
|
- PageRequest.of(i, pageSize));
|
|
|
|
|
|
|
+ PageRequest.of(i, pageSize, Sort.by(Sort.Direction.DESC, "source_id")));
|
|
|
List<ArticleTitleHisCache> cacheList = articleTitleHisCachePage.getContent();
|
|
List<ArticleTitleHisCache> cacheList = articleTitleHisCachePage.getContent();
|
|
|
if (CollectionUtils.isEmpty(cacheList)) {
|
|
if (CollectionUtils.isEmpty(cacheList)) {
|
|
|
return;
|
|
return;
|