Bladeren bron

待发布内容预过滤

wangyunpeng 4 weken geleden
bovenliggende
commit
28022c5b51

+ 5 - 1
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/XxlJobService.java

@@ -1133,6 +1133,7 @@ public class XxlJobService {
         for (PublishPlanAccountDTO item : planAccountList) {
             String redisKey = "ContentPreFilterJob:" + dateStr + ":" + item.getPlanId() + "-" + item.getAccountId();
             thread.submit(() -> {
+                boolean success = false;
                 try {
                     String value = redisTemplate.opsForValue().get(redisKey);
                     if (StringUtils.hasText(value)) {
@@ -1156,9 +1157,12 @@ public class XxlJobService {
                         log.info("ContentPreFilterJob success planId: {} accountId: {} filterContent: {}",
                                 item.getPlanId(), item.getAccountId(), filterContentList.size());
                         recommendService.updateWaitingContentFilter(filterContentList);
+                        success = true;
                     }
                 } finally {
-                    redisTemplate.opsForValue().set(redisKey, "1", 1, TimeUnit.DAYS);
+                    if (success) {
+                        redisTemplate.opsForValue().set(redisKey, "1", 1, TimeUnit.DAYS);
+                    }
                     cdl.countDown();
                 }
             });