Преглед на файлове

待发布内容预过滤

wangyunpeng преди 4 месеца
родител
ревизия
28022c5b51
променени са 1 файла, в които са добавени 5 реда и са изтрити 1 реда
  1. 5 1
      long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/XxlJobService.java

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