perf: 增加运维检测开关

dev
huangfeng 1 year ago
parent ec9ba6a373
commit f349bbbd78

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

@ -8,6 +8,7 @@ import com.shxy.xymanager_service.service.CacheService;
import com.shxy.xymanager_service.service.NewCacheService; import com.shxy.xymanager_service.service.NewCacheService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled; import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@ -23,6 +24,9 @@ public class MntnCheckTask {
private int max = 20; private int max = 20;
private HashMap<Integer, Long> alertMap = new HashMap<>(); private HashMap<Integer, Long> alertMap = new HashMap<>();
@Value("${maintain.check}")
private boolean needCheck;
@Resource @Resource
MntnRawReportsMapper rawReportsMapper; MntnRawReportsMapper rawReportsMapper;
@Resource @Resource
@ -54,6 +58,7 @@ public class MntnCheckTask {
@Scheduled(initialDelay = 60000, fixedDelay = 60000) @Scheduled(initialDelay = 60000, fixedDelay = 60000)
private void checkAll() { private void checkAll() {
if (needCheck) {
try { try {
log.info("MntnCheckTask.checkAll 开始."); log.info("MntnCheckTask.checkAll 开始.");
Map<Integer, Terminals> terminalMap = cacheService.getTerminalMap(); Map<Integer, Terminals> terminalMap = cacheService.getTerminalMap();
@ -67,6 +72,7 @@ public class MntnCheckTask {
log.error("MntnCheckTask.checkAll error.", e); log.error("MntnCheckTask.checkAll error.", e);
} }
} }
}
private void checkOne(Integer termId) { private void checkOne(Integer termId) {
Terminals term = newCacheService.getTerminal(termId); Terminals term = newCacheService.getTerminal(termId);

Loading…
Cancel
Save