Browse Source

三次轮训跳出

yejian 3 years ago
parent
commit
4451e24efb

+ 25 - 12
imcs-admin-boot/imcs-business-biz/src/main/java/com/github/zuihou/business/mq/TaskWorkNode.java

@@ -48,6 +48,7 @@ import com.github.zuihou.tenant.service.ModuleInstructionService;
 import com.github.zuihou.tenant.service.ModuleService;
 import com.google.common.collect.Maps;
 import jdk.nashorn.internal.runtime.regexp.joni.exception.InternalException;
+import net.sf.jsqlparser.statement.select.KSQLWindow;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -186,7 +187,7 @@ public class TaskWorkNode {
             msgUtil.redis_set(CacheKey.PRESOURCE_CURRENT_TASK_OBJECT + "_" + tTask.getResourceId(), tTask);
         }
         //获取配置节点
-        String autoProgramUrl = getInterfaceUrl(taskNode);
+//        String autoProgramUrl = getInterfaceUrl(taskNode);
 
         //填充配置节点内容
         ResourceAutoCode resourceAutoCode = resourceAutoCodeService.getById(taskNode.getAutoNode().getId());
@@ -210,7 +211,7 @@ public class TaskWorkNode {
         taskNode.setExeStatus("2").setStartTime(new Date());
         taskNodeMapper.updateAllById(taskNode);
 
-        logger.info("==================请求地址=============" + autoProgramUrl);
+//        logger.info("==================请求地址=============" + autoProgramUrl);
         String returnData = "";
 
         try {
@@ -425,17 +426,29 @@ public class TaskWorkNode {
      * @throws Exception
      */
     public Map checkCon(TaskNode taskNode, TTask task, Map<String, Object> dataMap) {
-        Map map = getCheckCon(taskNode, task, dataMap);
-        boolean b = (boolean) map.get("result");
-        if (!b) {
-            try {
-                Thread.sleep(10000);
-            } catch (InterruptedException e) {
-                e.printStackTrace();
+        Object repeatCount = msgUtil.redis_get("repeatCheckOnCount"+taskNode.getId());
+        int repeatCheckOnCount;
+        if(null == repeatCount){
+            repeatCheckOnCount = 1;
+        }else{
+            repeatCheckOnCount = Integer.valueOf(repeatCount.toString()) + 1;
+        }
+        if(repeatCheckOnCount > 3){
+            return null;
+        }else{
+            msgUtil.redis_set("repeatCheckOnCount"+taskNode.getId(),repeatCheckOnCount,10, TimeUnit.MINUTES);
+            Map map = getCheckCon(taskNode, task, dataMap);
+            boolean b = (boolean) map.get("result");
+            if (!b) {
+                try {
+                    Thread.sleep(10000);
+                } catch (InterruptedException e) {
+                    e.printStackTrace();
+                }
+                return checkCon(taskNode, task, dataMap);
+            } else {
+                return map;
             }
-            return checkCon(taskNode, task, dataMap);
-        } else {
-            return map;
         }
 //        logger.info("异步消息获取执行状态:");
 //        //单线程化线程池