perf: 增加运维检测开关

dev
huangfeng 1 year ago
parent ec9ba6a373
commit f349bbbd78

@ -94,6 +94,7 @@ maintain:
termlog: /home/xymp/termLogs/
apk: /home/xymp/apk/
uri: http://61.169.135.146:40085/
check: false
cma:
server: 127.0.0.1

@ -8,6 +8,7 @@ import com.shxy.xymanager_service.service.CacheService;
import com.shxy.xymanager_service.service.NewCacheService;
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.Service;
@ -23,6 +24,9 @@ public class MntnCheckTask {
private int max = 20;
private HashMap<Integer, Long> alertMap = new HashMap<>();
@Value("${maintain.check}")
private boolean needCheck;
@Resource
MntnRawReportsMapper rawReportsMapper;
@Resource
@ -54,17 +58,19 @@ public class MntnCheckTask {
@Scheduled(initialDelay = 60000, fixedDelay = 60000)
private void checkAll() {
try {
log.info("MntnCheckTask.checkAll 开始.");
Map<Integer, Terminals> terminalMap = cacheService.getTerminalMap();
Iterator<Integer> it = terminalMap.keySet().iterator();
while (shutdown == 0 && it.hasNext()) {
Integer termId = it.next();
this.checkOne(termId);
if (needCheck) {
try {
log.info("MntnCheckTask.checkAll 开始.");
Map<Integer, Terminals> terminalMap = cacheService.getTerminalMap();
Iterator<Integer> it = terminalMap.keySet().iterator();
while (shutdown == 0 && it.hasNext()) {
Integer termId = it.next();
this.checkOne(termId);
}
log.info("MntnCheckTask.checkAll 结束.");
} catch (Exception e) {
log.error("MntnCheckTask.checkAll error.", e);
}
log.info("MntnCheckTask.checkAll 结束.");
} catch (Exception e) {
log.error("MntnCheckTask.checkAll error.", e);
}
}

Loading…
Cancel
Save