优化启动后从redis查询推流设备状态

pull/1669/head
648540858 2024-10-24 16:56:37 +08:00
parent bf3e181bdb
commit af27ae0dfc
2 changed files with 14 additions and 9 deletions

View File

@ -82,7 +82,6 @@ public class HookSubscribe {
}
public void addSubscribe(Hook hook, HookSubscribe.Event event) {
System.out.println("add==" + hook.toString());
if (hook.getExpireTime() == null) {
hook.setExpireTime(System.currentTimeMillis() + subscribeExpire);
}

View File

@ -100,15 +100,21 @@ public class RedisPushStreamStatusMsgListener implements MessageListener, Applic
@Override
public void run(ApplicationArguments args) throws Exception {
if (!userSetting.isUsePushingAsStatus()) {
// 启动时设置所有推流通道离线,发起查询请求
redisCatchStorage.sendStreamPushRequestedMsgForStatus();
dynamicTask.startDelay(VideoManagerConstants.VM_MSG_GET_ALL_ONLINE_REQUESTED, () -> {
log.info("[REDIS消息]未收到redis回复推流设备状态执行推流设备离线");
// 五秒收不到请求就设置通道离线,然后通知上级离线
streamPushService.allOffline();
}, 5000);
if (userSetting.isUsePushingAsStatus()) {
return;
}
// 查询是否存在推流设备,没有则不发送
List<String> allAppAndStream = streamPushService.getAllAppAndStream();
if (allAppAndStream == null || allAppAndStream.isEmpty()) {
return;
}
// 启动时设置所有推流通道离线,发起查询请求
redisCatchStorage.sendStreamPushRequestedMsgForStatus();
dynamicTask.startDelay(VideoManagerConstants.VM_MSG_GET_ALL_ONLINE_REQUESTED, () -> {
log.info("[REDIS消息]未收到redis回复推流设备状态执行推流设备离线");
// 五秒收不到请求就设置通道离线,然后通知上级离线
streamPushService.allOffline();
}, 5000);
}
}