Browse Source

启动时清除先前注册上级平台的缓存

pull/74/head
lawrencehj 4 years ago
parent
commit
c5a05c15df
  1. 3
      src/main/java/com/genersoft/iot/vmp/conf/SipPlatformRunner.java
  2. 2
      src/main/java/com/genersoft/iot/vmp/storager/IRedisCatchStorage.java
  3. 9
      src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java

3
src/main/java/com/genersoft/iot/vmp/conf/SipPlatformRunner.java

@ -33,6 +33,9 @@ public class SipPlatformRunner implements CommandLineRunner {
// 设置所有平台离线 // 设置所有平台离线
storager.outlineForAllParentPlatform(); storager.outlineForAllParentPlatform();
// 清理所有平台注册缓存
redisCatchStorage.cleanPlatformRegisterInfos();
List<ParentPlatform> parentPlatforms = storager.queryEnableParentPlatformList(true); List<ParentPlatform> parentPlatforms = storager.queryEnableParentPlatformList(true);
for (ParentPlatform parentPlatform : parentPlatforms) { for (ParentPlatform parentPlatform : parentPlatforms) {

2
src/main/java/com/genersoft/iot/vmp/storager/IRedisCatchStorage.java

@ -81,6 +81,8 @@ public interface IRedisCatchStorage {
void delPlatformRegisterInfo(String callId); void delPlatformRegisterInfo(String callId);
void cleanPlatformRegisterInfos();
void updateSendRTPSever(SendRtpItem sendRtpItem); void updateSendRTPSever(SendRtpItem sendRtpItem);
/** /**

9
src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java

@ -13,6 +13,7 @@ import org.springframework.stereotype.Component;
import java.util.*; import java.util.*;
@SuppressWarnings("rawtypes")
@Component @Component
public class RedisCatchStorageImpl implements IRedisCatchStorage { public class RedisCatchStorageImpl implements IRedisCatchStorage {
@ -212,6 +213,14 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
redis.del(VideoManagerConstants.PLATFORM_REGISTER_INFO_PREFIX + callId); redis.del(VideoManagerConstants.PLATFORM_REGISTER_INFO_PREFIX + callId);
} }
@Override
public void cleanPlatformRegisterInfos() {
List regInfos = redis.scan(VideoManagerConstants.PLATFORM_REGISTER_INFO_PREFIX + "*");
for (Object key : regInfos) {
redis.del(key.toString());
}
}
@Override @Override
public void updateSendRTPSever(SendRtpItem sendRtpItem) { public void updateSendRTPSever(SendRtpItem sendRtpItem) {
String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + sendRtpItem.getPlatformId() + "_" + sendRtpItem.getChannelId(); String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + sendRtpItem.getPlatformId() + "_" + sendRtpItem.getChannelId();

Loading…
Cancel
Save