Kaynağa Gözat

去掉定时任务

dengsixing 3 yıl önce
ebeveyn
işleme
95f452ad4c

+ 98 - 98
4dkankan-center-scene/src/main/java/com/fdkankan/scene/schedule/ScheduleJob.java

@@ -1,99 +1,99 @@
-package com.fdkankan.scene.schedule;
-
-import com.fdkankan.common.util.RubberSheetingUtil;
-import com.fdkankan.rabbitmq.util.RabbitMqProducer;
-import com.fdkankan.redis.constant.RedisKey;
-import com.fdkankan.redis.constant.RedisLockKey;
-import com.fdkankan.redis.util.RedisLockUtil;
-import com.fdkankan.scene.service.IScene3dNumService;
-import com.fdkankan.scene.service.ISceneService;
-import lombok.extern.slf4j.Slf4j;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.beans.factory.annotation.Value;
-import org.springframework.scheduling.annotation.Scheduled;
-import org.springframework.stereotype.Component;
-
-@Slf4j
-@Component
-public class ScheduleJob {
-
-    @Value("${environment}")
-    private String environment;
-    @Value("${queue.modeling.modeling-call}")
-    private String queueModelingCall;
-    @Value("${scaling.mq.threshold.modeling-call}")
-    private String modelingCallMqThreshold;
-
-    @Autowired
-    ISceneService sceneService;
-    @Autowired
-    private IScene3dNumService scene3dNumService;
-    @Autowired
-    private RedisLockUtil redisLockUtil;
-    @Autowired
-    RubberSheetingUtil rubberSheetingUtil;
-    @Autowired
-    RabbitMqProducer rabbitMqProducer;
-
-//    /**
-//     * 更新浏览量
-//     */
-//    @Scheduled(cron = "0 0/10 * * * ? ")
-//    public void updateViewCount() {
-//        if("hq".equals(environment)){
-//            return;
-//        }
-//        log.info("执行定时任务开始:更新浏览量");
-//        try {
-//            //更新浏览量
-//            sceneService.updatePv();
-//        } catch (Exception e) {
-//            log.error("更新浏览量定时任务出错:", e);
-//        }
-//        log.info("执行定时任务结束:更新浏览量");
-//    }
+//package com.fdkankan.scene.schedule;
 //
-//    /**
-//     * <p>
-//            定时生成场景码
-//            查询码池中未使用场景码数量,如果小于阈值,执行批量生成
-//     * </p>
-//     * @author dengsixing
-//     * @date 2022/3/26
-//     **/
-//    @Scheduled(cron = "0 0/1 * * * ? ")
-//    public void generateSceneCode(){
-//        log.info("执行定时任务开始:批量生成场景码");
-//        scene3dNumService.batchCreateSceneNum();
-//        log.info("执行定时任务结束:批量生成场景码");
-//    }
-
-//    /**
-//     * 开启场景计算弹性伸缩
-//     */
-//    @Scheduled(cron = "0 0/5 8-21 * * ? ")
-//    public void startupModelingServer() {
-//        if("hq".equals(environment)){
-//            return;
-//        }
-//        boolean lock = redisLockUtil.lock(
-//            RedisLockKey.LOCK_STARTUP_MODELING_SERVER, RedisKey.EXPIRE_TIME_5_MINUTE);
-//        if(!lock){
-//            return;
-//        }
-//        try {
-//            //当mq排队数大于指定数量时使用弹性升缩
-//            int mqNum = rabbitMqProducer.getMessageCount(queueModelingCall);
-//            log.info("每5分钟查询一次排队队列,mqNum:" + mqNum);
-//            if(mqNum - Integer.parseInt(modelingCallMqThreshold) > 0){
-//                String responce = rubberSheetingUtil.createEcs();
-//                log.info("开启弹性伸缩:{}", responce);
-//            }
-//        } catch (Exception e) {
-//            log.error(e.getMessage());
-//        }finally {
-//            redisLockUtil.unlockLua(RedisLockKey.LOCK_STARTUP_MODELING_SERVER);
-//        }
-//    }
-
-}
+//import com.fdkankan.common.util.RubberSheetingUtil;
+//import com.fdkankan.rabbitmq.util.RabbitMqProducer;
+//import com.fdkankan.redis.constant.RedisKey;
+//import com.fdkankan.redis.constant.RedisLockKey;
+//import com.fdkankan.redis.util.RedisLockUtil;
+//import com.fdkankan.scene.service.IScene3dNumService;
+//import com.fdkankan.scene.service.ISceneService;
+//import lombok.extern.slf4j.Slf4j;
+//import org.springframework.beans.factory.annotation.Autowired;
+//import org.springframework.beans.factory.annotation.Value;
+//import org.springframework.scheduling.annotation.Scheduled;
+//import org.springframework.stereotype.Component;
+//
+//@Slf4j
+//@Component
+//public class ScheduleJob {
+//
+//    @Value("${environment}")
+//    private String environment;
+//    @Value("${queue.modeling.modeling-call}")
+//    private String queueModelingCall;
+//    @Value("${scaling.mq.threshold.modeling-call}")
+//    private String modelingCallMqThreshold;
+//
+//    @Autowired
+//    ISceneService sceneService;
+//    @Autowired
+//    private IScene3dNumService scene3dNumService;
+//    @Autowired
+//    private RedisLockUtil redisLockUtil;
+//    @Autowired
+//    RubberSheetingUtil rubberSheetingUtil;
+//    @Autowired
+//    RabbitMqProducer rabbitMqProducer;
+//
+////    /**
+////     * 更新浏览量
+////     */
+////    @Scheduled(cron = "0 0/10 * * * ? ")
+////    public void updateViewCount() {
+////        if("hq".equals(environment)){
+////            return;
+////        }
+////        log.info("执行定时任务开始:更新浏览量");
+////        try {
+////            //更新浏览量
+////            sceneService.updatePv();
+////        } catch (Exception e) {
+////            log.error("更新浏览量定时任务出错:", e);
+////        }
+////        log.info("执行定时任务结束:更新浏览量");
+////    }
+////
+////    /**
+////     * <p>
+////            定时生成场景码
+////            查询码池中未使用场景码数量,如果小于阈值,执行批量生成
+////     * </p>
+////     * @author dengsixing
+////     * @date 2022/3/26
+////     **/
+////    @Scheduled(cron = "0 0/1 * * * ? ")
+////    public void generateSceneCode(){
+////        log.info("执行定时任务开始:批量生成场景码");
+////        scene3dNumService.batchCreateSceneNum();
+////        log.info("执行定时任务结束:批量生成场景码");
+////    }
+//
+////    /**
+////     * 开启场景计算弹性伸缩
+////     */
+////    @Scheduled(cron = "0 0/5 8-21 * * ? ")
+////    public void startupModelingServer() {
+////        if("hq".equals(environment)){
+////            return;
+////        }
+////        boolean lock = redisLockUtil.lock(
+////            RedisLockKey.LOCK_STARTUP_MODELING_SERVER, RedisKey.EXPIRE_TIME_5_MINUTE);
+////        if(!lock){
+////            return;
+////        }
+////        try {
+////            //当mq排队数大于指定数量时使用弹性升缩
+////            int mqNum = rabbitMqProducer.getMessageCount(queueModelingCall);
+////            log.info("每5分钟查询一次排队队列,mqNum:" + mqNum);
+////            if(mqNum - Integer.parseInt(modelingCallMqThreshold) > 0){
+////                String responce = rubberSheetingUtil.createEcs();
+////                log.info("开启弹性伸缩:{}", responce);
+////            }
+////        } catch (Exception e) {
+////            log.error(e.getMessage());
+////        }finally {
+////            redisLockUtil.unlockLua(RedisLockKey.LOCK_STARTUP_MODELING_SERVER);
+////        }
+////    }
+//
+//}