微调
This commit is contained in:
@@ -51,7 +51,6 @@ public class RedisKeyExpirationListener extends KeyExpirationEventMessageListene
|
||||
|
||||
// 最大尝试次数
|
||||
private static final int MAX_ATTEMPTS = 4;
|
||||
|
||||
// 当前尝试次数
|
||||
private static int attemptCount = 1;
|
||||
|
||||
@@ -110,16 +109,18 @@ public class RedisKeyExpirationListener extends KeyExpirationEventMessageListene
|
||||
scheduler.shutdown();
|
||||
}
|
||||
} else {
|
||||
scheduler.shutdown();
|
||||
attemptCount++;
|
||||
logDto.setResult(0);
|
||||
startSecondScheduledTask(scheduler,nDid,version);
|
||||
startSecondScheduledTask(nDid,version);
|
||||
}
|
||||
csLogsFeignClient.addUserLog(logDto);
|
||||
}, 0, 5, TimeUnit.SECONDS);
|
||||
}, 0, 1, TimeUnit.MINUTES);
|
||||
}
|
||||
|
||||
//启动第二个定时任务
|
||||
private void startSecondScheduledTask(ScheduledExecutorService scheduler, String nDid, String version) {
|
||||
private void startSecondScheduledTask(String nDid, String version) {
|
||||
ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
|
||||
ScheduledFuture<?> future = scheduler.scheduleAtFixedRate(() -> {
|
||||
System.out.println(nDid + "执行第二阶段重连定时任务...");
|
||||
DeviceLogDTO logDto = new DeviceLogDTO();
|
||||
@@ -133,6 +134,6 @@ public class RedisKeyExpirationListener extends KeyExpirationEventMessageListene
|
||||
logDto.setResult(0);
|
||||
}
|
||||
csLogsFeignClient.addUserLog(logDto);
|
||||
}, 0, 10, TimeUnit.SECONDS);
|
||||
}, 0, 10, TimeUnit.MINUTES);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -520,6 +520,7 @@ public class CsDeviceServiceImpl implements ICsDeviceService {
|
||||
public boolean devAccessAskTemplate(String nDid,String version,Integer mid) {
|
||||
boolean result = false;
|
||||
try {
|
||||
redisUtil.delete(AppRedisKey.MODEL + nDid);
|
||||
//询问装置当前所用模板
|
||||
ReqAndResDto.Req reqAndResParam = new ReqAndResDto.Req();
|
||||
reqAndResParam.setMid(mid);
|
||||
|
||||
Reference in New Issue
Block a user