Browse Source

冷启池生成计划改为apollo配置

wangyunpeng 8 months ago
parent
commit
b79c430954

+ 6 - 2
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/ArticleService.java

@@ -1,6 +1,7 @@
 package com.tzld.longarticle.recommend.server.service.recommend;
 
 import com.alibaba.fastjson.JSONObject;
+import com.ctrip.framework.apollo.spring.annotation.ApolloJsonValue;
 import com.google.common.collect.Lists;
 import com.google.common.util.concurrent.ThreadFactoryBuilder;
 import com.tzld.longarticle.recommend.server.common.CommonThreadPoolExecutor;
@@ -81,6 +82,11 @@ public class ArticleService {
     @Autowired
     KimiApiService kimiApiService;
 
+    @ApolloJsonValue("${cold.pool.produce.planId:[\"20240802021606053813696\", \"20240802080355355308981\",\n" +
+            "\"20240805154433785506170\", \"20240805154359027876170\", \"20241024100016206421084\", " +
+            "\"20241030070010871546586\"]}")
+    private static List<String> producePlanIds;
+
     private final static ExecutorService pool = new CommonThreadPoolExecutor(
             32,
             128,
@@ -335,8 +341,6 @@ public class ArticleService {
 
     public void articleCategory() {
         List<ArticleCrawlerPlan> articleCrawlerPlanList = articleCrawlerPlanRepository.getByStatus(StatusEnum.ZERO.getCode());
-        List<String> producePlanIds = Arrays.asList("20240802021606053813696", "20240802080355355308981",
-                "20240805154433785506170", "20240805154359027876170", "20241024100016206421084", "20241030070010871546586");
         for (ArticleCrawlerPlan crawlerPlan : articleCrawlerPlanList) {
             List<ProduceContentCrawlerVO> list = crawlerContentByPlanService.getCrawlerContentByPlan(crawlerPlan.getCrawlerPlanId(), producePlanIds);
             List<String> produceContentIds = list.stream().map(ProduceContentCrawlerVO::getProduceContentId).collect(Collectors.toList());