Explorar el Código

ProducePlanDetail retry

wangyunpeng hace 3 semanas
padre
commit
992135add0

+ 14 - 0
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/ArticlePromotionService.java

@@ -640,6 +640,20 @@ public class ArticlePromotionService {
         Map<String, Long> crawlerContentMap = crawlerContentList.stream().collect(Collectors.toMap(
                 CrawlerContent::getChannelContentId, CrawlerContent::getId));
         ProducePlanDetailVO detail = aigcProducePlanDetailService.articleGetProducePlanDetail(topProducePlanId);
+        int retryTimes = 5;
+        while (Objects.isNull(detail) && retryTimes > 0) {
+            detail = aigcProducePlanDetailService.articleGetProducePlanDetail(topProducePlanId);
+            retryTimes--;
+            try {
+                Thread.sleep(1000);
+            } catch (InterruptedException e) {
+                log.error( "topContentReSendJob detail sleep error: ", e);
+            }
+        }
+        if (Objects.isNull(detail)) {
+            log.error("topContentReSendJob detail is null");
+            return ReturnT.FAIL;
+        }
         for (PublishContentDTO item : publishContentList) {
             if (TitleSimilarCheckUtil.isDuplicateContent(item.getTitle(), existsTitles, TitleSimilarCheckUtil.ARTICLE_PROMOTION_THRESHOLD)) {
                 continue;