优化zlm上线与下线过时通道的移除
This commit is contained in:
parent
abc65c6317
commit
c547851487
@ -118,7 +118,7 @@ public class StreamPushServiceImpl implements IStreamPushService {
|
||||
|
||||
@Override
|
||||
public List<StreamPushItem> getPushList(String mediaServerId) {
|
||||
return streamPushMapper.selectAllByMediaServerId(mediaServerId);
|
||||
return streamPushMapper.selectAllByMediaServerIdWithOutGbID(mediaServerId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -204,7 +204,9 @@ public class StreamPushServiceImpl implements IStreamPushService {
|
||||
Map<String, MediaItem> streamInfoPushItemMap = new HashMap<>();
|
||||
if (pushList.size() > 0) {
|
||||
for (StreamPushItem streamPushItem : pushList) {
|
||||
pushItemMap.put(streamPushItem.getApp() + streamPushItem.getStream(), streamPushItem);
|
||||
if (StringUtils.isEmpty(streamPushItem.getGbId())) {
|
||||
pushItemMap.put(streamPushItem.getApp() + streamPushItem.getStream(), streamPushItem);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (mediaItems.size() > 0) {
|
||||
@ -268,7 +270,7 @@ public class StreamPushServiceImpl implements IStreamPushService {
|
||||
|
||||
@Override
|
||||
public void zlmServerOffline(String mediaServerId) {
|
||||
List<StreamPushItem> streamPushItems = streamPushMapper.selectAllByMediaServerId(mediaServerId);
|
||||
List<StreamPushItem> streamPushItems = streamPushMapper.selectAllByMediaServerIdWithOutGbID(mediaServerId);
|
||||
// 移除没有GBId的推流
|
||||
streamPushMapper.deleteWithoutGBId(mediaServerId);
|
||||
gbStreamMapper.deleteWithoutGBId("push", mediaServerId);
|
||||
|
@ -32,6 +32,14 @@ public interface StreamPushMapper {
|
||||
@Delete("DELETE FROM stream_push WHERE app=#{app} AND stream=#{stream}")
|
||||
int del(String app, String stream);
|
||||
|
||||
@Delete("<script> "+
|
||||
"DELETE sp FROM stream_push sp left join gb_stream gs on sp.app = gs.app AND sp.stream = gs.stream where " +
|
||||
"<foreach collection='streamPushItems' item='item' separator='or'>" +
|
||||
"(sp.app=#{item.app} and sp.stream=#{item.stream} and gs.gbId is null) " +
|
||||
"</foreach>" +
|
||||
"</script>")
|
||||
int delAllWithoutGBId(List<StreamPushItem> streamPushItems);
|
||||
|
||||
@Delete("<script> "+
|
||||
"DELETE FROM stream_push where " +
|
||||
"<foreach collection='streamPushItems' item='item' separator='or'>" +
|
||||
@ -62,10 +70,13 @@ public interface StreamPushMapper {
|
||||
@Delete("DELETE FROM stream_push")
|
||||
void clear();
|
||||
|
||||
@Delete("DELETE FROM stream_push WHERE mediaServerId=#{mediaServerId}")
|
||||
@Delete("DELETE sp FROM stream_push sp left join gb_stream gs on gs.app = sp.app and gs.stream= sp.stream WHERE sp.mediaServerId=#{mediaServerId} and gs.gbId is null ")
|
||||
void deleteWithoutGBId(String mediaServerId);
|
||||
|
||||
@Select("SELECT * FROM stream_push WHERE mediaServerId=#{mediaServerId}")
|
||||
List<StreamPushItem> selectAllByMediaServerId(String mediaServerId);
|
||||
|
||||
@Select("SELECT sp.* FROM stream_push sp left join gb_stream gs on gs.app = sp.app and gs.stream= sp.stream WHERE sp.mediaServerId=#{mediaServerId} and gs.gbId is null")
|
||||
List<StreamPushItem> selectAllByMediaServerIdWithOutGbID(String mediaServerId);
|
||||
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ spring:
|
||||
datasource:
|
||||
# 使用mysql 打开23-28行注释, 删除29-36行
|
||||
name: wvp
|
||||
url: jdbc:mysql://127.0.0.1:3306/wvp?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true&allowMultiQueries=true
|
||||
url: jdbc:mysql://127.0.0.1:3306/wvp?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true&allowMultiQueries=true&useSSL=false
|
||||
username:
|
||||
password:
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
|
@ -20,7 +20,7 @@ spring:
|
||||
datasource:
|
||||
# 使用mysql 打开23-28行注释, 删除29-36行
|
||||
name: wvp
|
||||
url: jdbc:mysql://127.0.0.1:3306/wvp?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true&allowMultiQueries=true
|
||||
url: jdbc:mysql://127.0.0.1:3306/wvp?useUnicode=true&characterEncoding=UTF8&rewriteBatchedStatements=true&allowMultiQueries=true&useSSL=false
|
||||
username: root
|
||||
password: root
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
|
Loading…
Reference in New Issue
Block a user