修复离线失败 #1944

This commit is contained in:
lin
2025-08-25 15:44:18 +08:00
parent dfba1840e3
commit 416dac382e
4 changed files with 5 additions and 31 deletions

View File

@@ -50,14 +50,6 @@ public class SipSubscribe {
}
}
public void updateTimeout(String callId) {
SipEvent sipEvent = subscribes.get(callId);
if (sipEvent != null) {
delayQueue.remove(sipEvent);
delayQueue.offer(sipEvent);
}
}
public interface Event { void response(EventResult eventResult);
}

View File

@@ -94,7 +94,10 @@ public class DeviceStatusTaskRunner {
return false;
}
log.debug("[更新状态任务时间] 编号: {}", key);
// 如果值更改时间,如果队列中有多个元素时 超时无法出发。目前采用移除再加入的方法
delayQueue.remove(task);
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);

View File

@@ -94,7 +94,9 @@ public class SubscribeTaskRunner{
return false;
}
log.info("[更新订阅任务时间] {}, 编号: {}", task.getName(), key);
delayQueue.remove(task);
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);

View File

@@ -108,19 +108,6 @@ public class PlatformStatusTaskRunner {
return task.getSipTransactionInfo();
}
public boolean updateRegisterDelay(String platformServerId, long expirationTime) {
PlatformRegisterTask task = registerSubscribes.get(platformServerId);
if (task == null) {
return false;
}
log.info("[更新平台注册任务时间] 平台上级编号: {}", platformServerId);
task.setDelayTime(expirationTime);
String redisKey = String.format("%s_%s_%s", prefix, userSetting.getServerId(), platformServerId);
Duration duration = Duration.ofSeconds((expirationTime - System.currentTimeMillis())/1000);
redisTemplate.expire(redisKey, duration);
return true;
}
public boolean containsRegister(String platformServerId) {
return registerSubscribes.containsKey(platformServerId);
}
@@ -152,16 +139,6 @@ public class PlatformStatusTaskRunner {
return true;
}
public boolean updateKeepAliveDelay(String platformServerId, long expirationTime) {
PlatformKeepaliveTask task = keepaliveSubscribes.get(platformServerId);
if (task == null) {
return false;
}
log.info("[更新平台心跳任务时间] 平台上级编号: {}", platformServerId);
task.setDelayTime(expirationTime);
return true;
}
public boolean containsKeepAlive(String platformServerId) {
return keepaliveSubscribes.containsKey(platformServerId);
}