1. 恢复状态查询和流量查询的频率
This commit is contained in:
parent
1a7634b9a6
commit
d873278da9
@ -1,6 +1,7 @@
|
||||
package com.imdroid.sideslope.task;
|
||||
|
||||
import com.alibaba.excel.util.StringUtils;
|
||||
import com.imdroid.common.util.ThreadManager;
|
||||
import com.imdroid.secapi.dto.*;
|
||||
import com.imdroid.sideslope.sal.Device;
|
||||
import com.imdroid.sideslope.sal.DeviceService;
|
||||
@ -47,40 +48,42 @@ public class SimStatusChecker {
|
||||
@Resource(name = "local")
|
||||
private DeviceService deviceService;
|
||||
|
||||
private static final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(3);
|
||||
@Autowired
|
||||
private SimCardQueryServiceImpl simCardQueryServiceImpl;
|
||||
|
||||
// 每小时执行一次状态检查调度
|
||||
//@Scheduled(cron = "0 0 * * * ?")
|
||||
@Scheduled(cron = "0 */10 * * * ?")
|
||||
@Scheduled(cron = "0 0 * * * ?")
|
||||
//@Scheduled(cron = "0 */10 * * * ?")
|
||||
private void scheduleSimCardStatusCheck() {
|
||||
List<GnssStatusJoin> onlineDevices = gnssStatusMapper.queryOnline();
|
||||
logger.info("当前在线设备数量: {}", onlineDevices.size());
|
||||
|
||||
for (GnssStatusJoin onlineDevice : onlineDevices) {
|
||||
//int delay = Math.abs(onlineDevice.getDeviceid().hashCode() % 3600 );
|
||||
int delay = Math.abs(onlineDevice.getDeviceid().hashCode() % 600 );
|
||||
int delay = Math.abs(onlineDevice.getDeviceid().hashCode() % 3600 );
|
||||
logger.info("- 设备: {}, SIM状态查询,延迟执行: {}秒", onlineDevice.getDeviceid(), delay);
|
||||
|
||||
scheduler.schedule(() -> checkDeviceSimCardStatus(onlineDevice.getDeviceid()),
|
||||
delay, TimeUnit.SECONDS);
|
||||
ThreadManager.getScheduledThreadPool().schedule(
|
||||
() -> checkDeviceSimCardStatus(onlineDevice.getDeviceid()),
|
||||
delay,
|
||||
TimeUnit.SECONDS
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// 每两小时执行一次流量检查调度
|
||||
//@Scheduled(cron = "0 0 0/2 * * ?")
|
||||
@Scheduled(cron = "0 */20 * * * ?")
|
||||
@Scheduled(cron = "0 0 0/2 * * ?")
|
||||
private void scheduleSimCardTrafficCheck() {
|
||||
List<GnssStatusJoin> onlineDevices = gnssStatusMapper.queryOnline();
|
||||
logger.info("当前在线设备数量: {}", onlineDevices.size());
|
||||
|
||||
for (GnssStatusJoin onlineDevice : onlineDevices) {
|
||||
int delay = Math.abs(onlineDevice.getDeviceid().hashCode() % 1200);
|
||||
int delay = Math.abs(onlineDevice.getDeviceid().hashCode() % 7200);
|
||||
logger.debug("- 设备: {}, SIM流量查询,延迟执行: {}秒", onlineDevice.getDeviceid(), delay);
|
||||
|
||||
scheduler.schedule(() -> checkDeviceSimCardTraffic(onlineDevice.getDeviceid()),
|
||||
delay, TimeUnit.SECONDS);
|
||||
ThreadManager.getScheduledThreadPool().schedule(
|
||||
() -> checkDeviceSimCardTraffic(onlineDevice.getDeviceid()),
|
||||
delay,
|
||||
TimeUnit.SECONDS
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user