Merge pull request #647 from L120820/wvp-28181-2.0

【zlm心跳hook】重复查询redis了
This commit is contained in:
648540858 2022-10-25 14:43:12 +08:00 committed by GitHub
commit f3454caaf6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -649,19 +649,18 @@ public class MediaServerServiceImpl implements IMediaServerService {
MediaServerItem mediaServerItem = getOne(mediaServerId); MediaServerItem mediaServerItem = getOne(mediaServerId);
if (mediaServerItem == null) { if (mediaServerItem == null) {
// 缓存不存在从数据库查询如果数据库不存在则是错误的 // 缓存不存在从数据库查询如果数据库不存在则是错误的
MediaServerItem mediaServerItemFromDatabase = getOneFromDatabase(mediaServerId); mediaServerItem = getOneFromDatabase(mediaServerId);
if (mediaServerItemFromDatabase == null) {
return;
}
// zlm连接重试
logger.warn("[更新ZLM 保活信息]失败,未找到流媒体信息,尝试重连zlm");
// reloadZlm();
mediaServerItem = getOne(mediaServerId);
if (mediaServerItem == null) { if (mediaServerItem == null) {
// zlm连接重试
logger.warn("[更新ZLM 保活信息]失败,未找到流媒体信息"); logger.warn("[更新ZLM 保活信息]失败,未找到流媒体信息");
return; return;
} }
// zlm连接重试
logger.warn("[更新ZLM 保活信息]尝试链接zml id {}", mediaServerId);
SsrcConfig ssrcConfig = new SsrcConfig(mediaServerItem.getId(), null, sipConfig.getDomain());
mediaServerItem.setSsrcConfig(ssrcConfig);
String key = VideoManagerConstants.MEDIA_SERVER_PREFIX + userSetting.getServerId() + "_" + mediaServerItem.getId();
RedisUtil.set(key, mediaServerItem);
clearRTPServer(mediaServerItem);
} }
final String zlmKeepaliveKey = zlmKeepaliveKeyPrefix + mediaServerItem.getId(); final String zlmKeepaliveKey = zlmKeepaliveKeyPrefix + mediaServerItem.getId();
dynamicTask.stop(zlmKeepaliveKey); dynamicTask.stop(zlmKeepaliveKey);