优化延时任务到期时间更新
This commit is contained in:
@@ -506,7 +506,11 @@ public class DeviceServiceImpl implements IDeviceService, CommandLineRunner {
|
||||
if (device == null || device.getSubscribeCycleForCatalog() < 0) {
|
||||
return false;
|
||||
}
|
||||
log.info("[添加目录订阅] 设备 {}", device.getDeviceId());
|
||||
if (transactionInfo == null) {
|
||||
log.info("[添加目录订阅] 设备 {}", device.getDeviceId());
|
||||
}else {
|
||||
log.info("[目录订阅续期] 设备 {}", device.getDeviceId());
|
||||
}
|
||||
try {
|
||||
sipCommander.catalogSubscribe(device, transactionInfo, eventResult -> {
|
||||
ResponseEvent event = (ResponseEvent) eventResult.event;
|
||||
@@ -566,7 +570,11 @@ public class DeviceServiceImpl implements IDeviceService, CommandLineRunner {
|
||||
|
||||
@Override
|
||||
public boolean addMobilePositionSubscribe(@NotNull Device device, SipTransactionInfo transactionInfo) {
|
||||
log.info("[添加移动位置订阅] 设备 {}", device.getDeviceId());
|
||||
if (transactionInfo == null) {
|
||||
log.info("[添加移动位置订阅] 设备 {}", device.getDeviceId());
|
||||
}else {
|
||||
log.info("[移动位置订阅续期] 设备 {}", device.getDeviceId());
|
||||
}
|
||||
try {
|
||||
sipCommander.mobilePositionSubscribe(device, transactionInfo, eventResult -> {
|
||||
ResponseEvent event = (ResponseEvent) eventResult.event;
|
||||
|
||||
@@ -94,14 +94,7 @@ public class DeviceStatusTaskRunner {
|
||||
return false;
|
||||
}
|
||||
log.debug("[更新状态任务时间] 编号: {}", key);
|
||||
if (delayQueue.contains(task)) {
|
||||
boolean remove = delayQueue.remove(task);
|
||||
if (!remove) {
|
||||
log.info("[更新状态任务时间] 从延时队列内移除失败: {}", key);
|
||||
}
|
||||
}
|
||||
task.setDelayTime(expirationTime);
|
||||
delayQueue.offer(task);
|
||||
String redisKey = String.format("%s_%s_%s", prefix, userSetting.getServerId(), task.getDeviceId());
|
||||
Duration duration = Duration.ofSeconds((expirationTime - System.currentTimeMillis())/1000);
|
||||
redisTemplate.expire(redisKey, duration);
|
||||
|
||||
@@ -94,14 +94,7 @@ public class SubscribeTaskRunner{
|
||||
return false;
|
||||
}
|
||||
log.info("[更新订阅任务时间] {}, 编号: {}", task.getName(), key);
|
||||
if (delayQueue.contains(task)) {
|
||||
boolean remove = delayQueue.remove(task);
|
||||
if (!remove) {
|
||||
log.info("[更新订阅任务时间] 从延时队列内移除失败: {}", key);
|
||||
}
|
||||
}
|
||||
task.setDelayTime(expirationTime);
|
||||
delayQueue.offer(task);
|
||||
String redisKey = String.format("%s_%s_%s", prefix, userSetting.getServerId(), task.getKey());
|
||||
Duration duration = Duration.ofSeconds((expirationTime - System.currentTimeMillis())/1000);
|
||||
redisTemplate.expire(redisKey, duration);
|
||||
|
||||
@@ -114,14 +114,7 @@ public class PlatformStatusTaskRunner {
|
||||
return false;
|
||||
}
|
||||
log.info("[更新平台注册任务时间] 平台上级编号: {}", platformServerId);
|
||||
if (registerDelayQueue.contains(task)) {
|
||||
boolean remove = registerDelayQueue.remove(task);
|
||||
if (!remove) {
|
||||
log.info("[更新平台注册任务时间] 从延时队列内移除失败: {}", platformServerId);
|
||||
}
|
||||
}
|
||||
task.setDelayTime(expirationTime);
|
||||
registerDelayQueue.offer(task);
|
||||
String redisKey = String.format("%s_%s_%s", prefix, userSetting.getServerId(), platformServerId);
|
||||
Duration duration = Duration.ofSeconds((expirationTime - System.currentTimeMillis())/1000);
|
||||
redisTemplate.expire(redisKey, duration);
|
||||
@@ -165,14 +158,7 @@ public class PlatformStatusTaskRunner {
|
||||
return false;
|
||||
}
|
||||
log.info("[更新平台心跳任务时间] 平台上级编号: {}", platformServerId);
|
||||
if (keepaliveTaskDelayQueue.contains(task)) {
|
||||
boolean remove = keepaliveTaskDelayQueue.remove(task);
|
||||
if (!remove) {
|
||||
log.info("[更新平台心跳任务时间] 从延时队列内移除失败: {}", platformServerId);
|
||||
}
|
||||
}
|
||||
task.setDelayTime(expirationTime);
|
||||
keepaliveTaskDelayQueue.offer(task);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user