Explorar el Código

feat: 修改了定时清除过期实例的逻辑,将过期实例由过去24h以前定义为了过去12h以前

刘一也 hace 4 años
padre
commit
bdccf77f04

+ 5 - 5
web/src/main/java/cn/seecoder/web/infrastructure/ScheduledTasks.java

@@ -7,8 +7,7 @@ import cn.seecoder.web.model.po.pipeline.DeploymentPO;
 import cn.seecoder.web.model.po.pipeline.PipelinePO;
 import cn.seecoder.web.service.pipeline.DeploymentService;
 import lombok.RequiredArgsConstructor;
-import lombok.extern.log4j.Log4j;
-import lombok.extern.log4j.Log4j2;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.scheduling.annotation.Async;
 import org.springframework.scheduling.annotation.Scheduled;
 import org.springframework.stereotype.Component;
@@ -16,7 +15,7 @@ import org.springframework.stereotype.Component;
 import java.sql.Timestamp;
 import java.util.List;
 
-@Log4j2
+@Slf4j
 @RequiredArgsConstructor
 @Async
 @Component
@@ -27,8 +26,9 @@ public class ScheduledTasks {
 
     @Scheduled(cron = "0 0 1 * * ?")
     public void purgeZombieDeployments() {
-        long ONE_DAY_MILLIS = 86400000L;
-        Timestamp expireLimit = new Timestamp(System.currentTimeMillis() - ONE_DAY_MILLIS);
+//        final long ONE_DAY_MILLIS = 86400000L;
+        final long HALF_DAY_MILLIS = 43200000L;
+        Timestamp expireLimit = new Timestamp(System.currentTimeMillis() - HALF_DAY_MILLIS);
         List<DeploymentPO> deploymentPOList = deploymentMapper.selectAllDeployments();
         for (DeploymentPO deploymentPO: deploymentPOList) {
             Timestamp deployedTime = deploymentPO.getDeployedTime();