wangyunpeng před 4 měsíci
rodič
revize
83c307f6bf

+ 3 - 3
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/ArticleVideoAuditService.java

@@ -129,7 +129,7 @@ public class ArticleVideoAuditService {
         int retryCount = 0;
         boolean lockAcquired = false;
 
-        // 尝试获取分布式锁,最多重试10秒,每次间隔1秒
+        // 尝试获取分布式锁,最多重试10次,每次间隔200ms
         while (retryCount < 10) {
             lockAcquired = redisUtil.tryAcquireLock(lockKey, requestId);
             if (lockAcquired) {
@@ -137,7 +137,7 @@ public class ArticleVideoAuditService {
             }
             retryCount++;
             try {
-                Thread.sleep(1000); // 等待1秒后重试
+                Thread.sleep(200); // 等待200ms后重试
             } catch (InterruptedException e) {
                 Thread.currentThread().interrupt();
                 return result; // 返回空结果
@@ -194,7 +194,7 @@ public class ArticleVideoAuditService {
         // 添加到超时队列
         JSONObject json = new JSONObject();
         json.put("id", item.getContentId());
-        json.put("timestamp", now + 900000);
+        json.put("timestamp", now + (15 * 60 * 1000));
         redisTemplate.opsForList().rightPush(nextListRedisKey, json.toJSONString());
         List<ArticleVideoAuditListVO> list = Collections.singletonList(item);
         buildArticleVideoAuditListVO(list);

+ 3 - 3
long-article-recommend-service/src/main/java/com/tzld/longarticle/recommend/server/service/recommend/VideoPoolAuditService.java

@@ -102,7 +102,7 @@ public class VideoPoolAuditService {
         int retryCount = 0;
         boolean lockAcquired = false;
 
-        // 尝试获取分布式锁,最多重试10秒,每次间隔1秒
+        // 尝试获取分布式锁,最多重试10次,每次间隔200ms
         while (retryCount < 10) {
             lockAcquired = redisUtil.tryAcquireLock(lockKey, requestId);
             if (lockAcquired) {
@@ -110,7 +110,7 @@ public class VideoPoolAuditService {
             }
             retryCount++;
             try {
-                Thread.sleep(1000); // 等待1秒后重试
+                Thread.sleep(200); // 等待200ms后重试
             } catch (InterruptedException e) {
                 Thread.currentThread().interrupt();
                 return result; // 返回空结果
@@ -163,7 +163,7 @@ public class VideoPoolAuditService {
         // 添加到超时队列
         JSONObject json = new JSONObject();
         json.put("id", obj.getContentTraceId());
-        json.put("timestamp", now + 600000);
+        json.put("timestamp", now + (10 * 60 * 1000));
         redisTemplate.opsForList().rightPush(nextListRedisKey, json.toJSONString());
         // 填充数据
         List<VideoPoolAuditListVO> list = buildVideoPoolAuditListVO(Collections.singletonList(obj));