dengsixing пре 8 месеци
родитељ
комит
03685ff983
1 измењених фајлова са 26 додато и 25 уклоњено
  1. 26 25
      src/main/java/com/fdkankan/modeling/receiver/RabbitMqListener.java

+ 26 - 25
src/main/java/com/fdkankan/modeling/receiver/RabbitMqListener.java

@@ -355,32 +355,33 @@ public class RabbitMqListener {
         buildLog.setUpdateTime(new Date());
         buildLog.setBuildType(0);
         buildLog.setStatus(0);
-        // 设置缓存锁
-        String key = SysConstants.SCENE_BUILDING + buildLog.getSceneNum();
-        // 如果是强制重新计算,则删除key。
-        if (StringUtils.equals(message.getRebuild(), "1")) {
-            redisUtil.del(key);
-        }
-
-        // 获取缓存锁,防止重复消费
-        Long building = redisUtil.incr(key, 1);
         buildLogService.save(buildLog);
-
-        if(!ObjectUtils.isEmpty(buildLog.getMessageId())){
-            // 设置消息id幂等性,防止消息重复消费
-            boolean lock = redisLockUtil.lock(SysConstants.SCENE_MESSAGE_BUILDING + buildLog.getMessageId(), SysConstants.modelTimeOut * 3600);
-            if (!lock) {
-                log.error("服务:{},消息重复消费:{}", SysConstants.hostName, buildLog.getMessageId());
-                throw new BuildException(ModelingBuildStatus.REPEAT);
-            }
-        }
-
-        if (building.compareTo(1L) > 0) {
-            log.error("服务:{},重复构建:{},构建次数:{}", SysConstants.hostName, buildLog.getSceneNum(),building);
-            throw new BuildException(ModelingBuildStatus.REPEAT);
-        } else {
-            redisUtil.expire(key, Integer.toUnsignedLong(SysConstants.modelTimeOut * 3600));
-        }
+//        // 设置缓存锁
+//        String key = SysConstants.SCENE_BUILDING + buildLog.getSceneNum();
+//        // 如果是强制重新计算,则删除key。
+//        if (StringUtils.equals(message.getRebuild(), "1")) {
+//            redisUtil.del(key);
+//        }
+//
+//        // 获取缓存锁,防止重复消费
+//        Long building = redisUtil.incr(key, 1);
+//        buildLogService.save(buildLog);
+//
+//        if(!ObjectUtils.isEmpty(buildLog.getMessageId())){
+//            // 设置消息id幂等性,防止消息重复消费
+//            boolean lock = redisLockUtil.lock(SysConstants.SCENE_MESSAGE_BUILDING + buildLog.getMessageId(), SysConstants.modelTimeOut * 3600);
+//            if (!lock) {
+//                log.error("服务:{},消息重复消费:{}", SysConstants.hostName, buildLog.getMessageId());
+//                throw new BuildException(ModelingBuildStatus.REPEAT);
+//            }
+//        }
+//
+//        if (building.compareTo(1L) > 0) {
+//            log.error("服务:{},重复构建:{},构建次数:{}", SysConstants.hostName, buildLog.getSceneNum(),building);
+//            throw new BuildException(ModelingBuildStatus.REPEAT);
+//        } else {
+//            redisUtil.expire(key, Integer.toUnsignedLong(SysConstants.modelTimeOut * 3600));
+//        }
     }
 
     /**