浏览代码

达人数据更新睡眠时间

zhaoxian 1 年之前
父节点
当前提交
95310a4435
共有 1 个文件被更改,包括 14 次插入14 次删除
  1. 14 14
      ruixuan-live/src/main/java/com/ruixuan/isc/service/impl/KuaishouPromoterServiceImpl.java

+ 14 - 14
ruixuan-live/src/main/java/com/ruixuan/isc/service/impl/KuaishouPromoterServiceImpl.java

@@ -350,12 +350,12 @@ public class KuaishouPromoterServiceImpl implements IKuaishouPromoterService {
             Long startTime = System.currentTimeMillis();
             String content = "";
             if ("2".equals(mediaId)) {
+                //睡眠: 随机数3的倍数 3、6、9 ...33s
+                Thread.sleep(1000 * (int) (1+Math.random() * 11)*3);
                 content = HttpUtil.httpPostRequest(startIpPath + "promoterInfo/getPromoterId", param, null);
-                //睡眠: 随机数 3~25s
-                Thread.sleep(1000 * ((int) (3 + Math.random() * 27)));
             } else {
-                content = HttpUtil.httpPostRequest(startIpPath + "promoterInfo/getPromoterId", param, null);
                 Thread.sleep(60000);
+                content = HttpUtil.httpPostRequest(startIpPath + "promoterInfo/getPromoterId", param, null);
             }
             JSONObject result = JSONObject.parseObject(content);
             if (Check.isNotNull(result) && Check.isNotNull(result.getString("promoterNickName"))) {
@@ -413,8 +413,8 @@ public class KuaishouPromoterServiceImpl implements IKuaishouPromoterService {
                 redisUtil.set(key, "1", 60 * 60 * 24);
             }
 
-            //睡眠: 随机数 3~30s
-            Thread.sleep(1000 * ((int) (3 + Math.random() * 27)));
+            //睡眠: 随机数3的倍数 3、6、9 ...33s
+            Thread.sleep(1000 * (int) (1+Math.random() * 11)*3);
 
             /*更新达人数据*/
             Map<String, Object> param = new HashMap<>();
@@ -467,8 +467,8 @@ public class KuaishouPromoterServiceImpl implements IKuaishouPromoterService {
                 redisUtil.set(key, "1", 60 * 60 * 24);
             }
 
-            //睡眠: 随机数 3~30s
-            Thread.sleep(1000 * ((int) (3 + Math.random() * 27)));
+            //睡眠: 随机数3的倍数 3、6、9 ...33s
+            Thread.sleep(1000 * (int) (1+Math.random() * 11)*3);
 
             /*更新达人数据*/
             Map<String, Object> param = new HashMap<>();
@@ -522,8 +522,8 @@ public class KuaishouPromoterServiceImpl implements IKuaishouPromoterService {
                 redisUtil.set(key, "1", 60 * 60 * 24);
             }
 
-            //睡眠: 随机数 3~30s
-            Thread.sleep(1000 * ((int) (3 + Math.random() * 27)));
+            //睡眠: 随机数3的倍数 3、6、9 ...33s
+            Thread.sleep(1000 * (int) (1+Math.random() * 11)*3);
 
             /*更新达人数据*/
             Map<String, Object> param = new HashMap<>();
@@ -575,8 +575,8 @@ public class KuaishouPromoterServiceImpl implements IKuaishouPromoterService {
                 redisUtil.set(key, "1", 60 * 60 * 24);
             }
 
-            //睡眠: 随机数 3~30s
-            Thread.sleep(1000 * ((int) (3 + Math.random() * 27)));
+            //睡眠: 随机数3的倍数 3、6、9 ...33s
+            Thread.sleep(1000 * (int) (1+Math.random() * 11)*3);
 
             /*更新达人数据*/
             Map<String, Object> param = new HashMap<>();
@@ -627,8 +627,8 @@ public class KuaishouPromoterServiceImpl implements IKuaishouPromoterService {
                 redisUtil.set(key, "1", 60 * 60 * 24);
             }
 
-            //睡眠: 随机数 3~30s
-            Thread.sleep(1000 * ((int) (3 + Math.random() * 27)));
+            //睡眠: 随机数3的倍数 3、6、9 ...33s
+            Thread.sleep(1000 * (int) (1+Math.random() * 11)*3);
 
             /*更新达人数据*/
             Map<String, Object> param = new HashMap<>();
@@ -718,7 +718,7 @@ public class KuaishouPromoterServiceImpl implements IKuaishouPromoterService {
         return jsonObject;
     }
 
-    static ExecutorService editPromoterService = Executors.newFixedThreadPool(10);
+    static ExecutorService editPromoterService = Executors.newFixedThreadPool(6);
 
     @Override
     public Result supplementInfo() {