diff --git a/luoo_music/src/main/java/com/luoo/music/config/SaticScheduleTask.java b/luoo_music/src/main/java/com/luoo/music/config/SaticScheduleTask.java index 618b0c1..723b1e5 100644 --- a/luoo_music/src/main/java/com/luoo/music/config/SaticScheduleTask.java +++ b/luoo_music/src/main/java/com/luoo/music/config/SaticScheduleTask.java @@ -45,10 +45,9 @@ public class SaticScheduleTask { @Autowired private TagDao tagDao; - @PostConstruct - private void init() { - updateAutoComplete(); - } + /* + * @PostConstruct private void init() { updateAutoComplete(); } + */ // 1.凌晨4点执行更新期刊tag @Scheduled(cron = "0 0 4 * * *") @@ -61,27 +60,29 @@ public class SaticScheduleTask { } // 2.凌晨4:20点执行更新分词 - @Scheduled(cron = "0 20 4 * * *") - private void updateAutoComplete() { - Stream>> journalSongStream = journalSongDao.findAll().parallelStream() - .map(j -> getJournalSongMap(j)).flatMap(m -> m.entrySet().stream()); - - Stream>> journalStream = journalDao.findValidJournals().parallelStream() - .map(j -> getJournalMap(j)).flatMap(m -> m.entrySet().stream()); - - Map>>> map = Stream.concat(journalSongStream, journalStream) - .collect(Collectors.groupingBy(e -> e.getKey())); - - int keyCount = map.size(); - int cacheKeyCount = cacheChannel.keys(constants.Constants.J2CACHE_REGION_SEARCH_AUTO_COMPLETE).size(); - if (keyCount != cacheKeyCount) { - map.entrySet().parallelStream().forEach(e -> { - List value = e.getValue().stream().flatMap(a -> a.getValue().stream()).distinct().sorted() - .collect(Collectors.toList()); - cacheChannel.set(constants.Constants.J2CACHE_REGION_SEARCH_AUTO_COMPLETE, e.getKey(), value); - }); - } - } + /* + * @Scheduled(cron = "0 20 4 * * *") private void updateAutoComplete() { + * Stream>> journalSongStream = + * journalSongDao.findAll().parallelStream() .map(j -> + * getJournalSongMap(j)).flatMap(m -> m.entrySet().stream()); + * + * Stream>> journalStream = + * journalDao.findValidJournals().parallelStream() .map(j -> + * getJournalMap(j)).flatMap(m -> m.entrySet().stream()); + * + * Map>>> map = + * Stream.concat(journalSongStream, journalStream) + * .collect(Collectors.groupingBy(e -> e.getKey())); + * + * int keyCount = map.size(); int cacheKeyCount = + * cacheChannel.keys(constants.Constants.J2CACHE_REGION_SEARCH_AUTO_COMPLETE). + * size(); if (keyCount != cacheKeyCount) { + * map.entrySet().parallelStream().forEach(e -> { List value = + * e.getValue().stream().flatMap(a -> a.getValue().stream()).distinct().sorted() + * .collect(Collectors.toList()); + * cacheChannel.set(constants.Constants.J2CACHE_REGION_SEARCH_AUTO_COMPLETE, + * e.getKey(), value); }); } } + */ private Map> getJournalMap(Journal j) { Map> map = new HashMap<>();