Commit c5a05c15df6c01602f259a49ff470fa996579b0b
1 parent
88dd1aca
启动时清除先前注册上级平台的缓存
Showing
3 changed files
with
14 additions
and
0 deletions
src/main/java/com/genersoft/iot/vmp/conf/SipPlatformRunner.java
| @@ -33,6 +33,9 @@ public class SipPlatformRunner implements CommandLineRunner { | @@ -33,6 +33,9 @@ public class SipPlatformRunner implements CommandLineRunner { | ||
| 33 | // 设置所有平台离线 | 33 | // 设置所有平台离线 |
| 34 | storager.outlineForAllParentPlatform(); | 34 | storager.outlineForAllParentPlatform(); |
| 35 | 35 | ||
| 36 | + // 清理所有平台注册缓存 | ||
| 37 | + redisCatchStorage.cleanPlatformRegisterInfos(); | ||
| 38 | + | ||
| 36 | List<ParentPlatform> parentPlatforms = storager.queryEnableParentPlatformList(true); | 39 | List<ParentPlatform> parentPlatforms = storager.queryEnableParentPlatformList(true); |
| 37 | 40 | ||
| 38 | for (ParentPlatform parentPlatform : parentPlatforms) { | 41 | for (ParentPlatform parentPlatform : parentPlatforms) { |
src/main/java/com/genersoft/iot/vmp/storager/IRedisCatchStorage.java
| @@ -81,6 +81,8 @@ public interface IRedisCatchStorage { | @@ -81,6 +81,8 @@ public interface IRedisCatchStorage { | ||
| 81 | 81 | ||
| 82 | void delPlatformRegisterInfo(String callId); | 82 | void delPlatformRegisterInfo(String callId); |
| 83 | 83 | ||
| 84 | + void cleanPlatformRegisterInfos(); | ||
| 85 | + | ||
| 84 | void updateSendRTPSever(SendRtpItem sendRtpItem); | 86 | void updateSendRTPSever(SendRtpItem sendRtpItem); |
| 85 | 87 | ||
| 86 | /** | 88 | /** |
src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java
| @@ -13,6 +13,7 @@ import org.springframework.stereotype.Component; | @@ -13,6 +13,7 @@ import org.springframework.stereotype.Component; | ||
| 13 | 13 | ||
| 14 | import java.util.*; | 14 | import java.util.*; |
| 15 | 15 | ||
| 16 | +@SuppressWarnings("rawtypes") | ||
| 16 | @Component | 17 | @Component |
| 17 | public class RedisCatchStorageImpl implements IRedisCatchStorage { | 18 | public class RedisCatchStorageImpl implements IRedisCatchStorage { |
| 18 | 19 | ||
| @@ -213,6 +214,14 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | @@ -213,6 +214,14 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage { | ||
| 213 | } | 214 | } |
| 214 | 215 | ||
| 215 | @Override | 216 | @Override |
| 217 | + public void cleanPlatformRegisterInfos() { | ||
| 218 | + List regInfos = redis.scan(VideoManagerConstants.PLATFORM_REGISTER_INFO_PREFIX + "*"); | ||
| 219 | + for (Object key : regInfos) { | ||
| 220 | + redis.del(key.toString()); | ||
| 221 | + } | ||
| 222 | + } | ||
| 223 | + | ||
| 224 | + @Override | ||
| 216 | public void updateSendRTPSever(SendRtpItem sendRtpItem) { | 225 | public void updateSendRTPSever(SendRtpItem sendRtpItem) { |
| 217 | String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + sendRtpItem.getPlatformId() + "_" + sendRtpItem.getChannelId(); | 226 | String key = VideoManagerConstants.PLATFORM_SEND_RTP_INFO_PREFIX + sendRtpItem.getPlatformId() + "_" + sendRtpItem.getChannelId(); |
| 218 | redis.set(key, sendRtpItem); | 227 | redis.set(key, sendRtpItem); |