Browse Source

解决启动设置所有设备离线未删除redis记录

pull/115/head
64850858 4 years ago
parent
commit
d09ee0c2ff
  1. 2
      src/main/java/com/genersoft/iot/vmp/common/VideoManagerConstants.java
  2. 2
      src/main/java/com/genersoft/iot/vmp/conf/SipDeviceRunner.java
  3. 5
      src/main/java/com/genersoft/iot/vmp/storager/IRedisCatchStorage.java
  4. 9
      src/main/java/com/genersoft/iot/vmp/storager/impl/RedisCatchStorageImpl.java

2
src/main/java/com/genersoft/iot/vmp/common/VideoManagerConstants.java

@ -16,7 +16,7 @@ public class VideoManagerConstants {
public static final String CACHEKEY_PREFIX = "VMP_channel_";
public static final String KEEPLIVEKEY_PREFIX = "VMP_keeplive_";
public static final String KEEPLIVEKEY_PREFIX = "VMP_KEEPLIVE_";
public static final String PLAYER_PREFIX = "VMP_player_";

2
src/main/java/com/genersoft/iot/vmp/conf/SipDeviceRunner.java

@ -29,5 +29,7 @@ public class SipDeviceRunner implements CommandLineRunner {
public void run(String... args) throws Exception {
// 设置所有设备离线
storager.outlineForAll();
// 设置所有设备离线
redisCatchStorage.outlineForAll();
}
}

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

@ -112,4 +112,9 @@ public interface IRedisCatchStorage {
* @param deviceId 设备ID
*/
void clearCatchByDeviceId(String deviceId);
/**
* 设置所有设备离线
*/
void outlineForAll();
}

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

@ -293,4 +293,13 @@ public class RedisCatchStorageImpl implements IRedisCatchStorage {
}
}
}
@Override
public void outlineForAll() {
List<Object> onlineDevices = redis.scan(String.format("%S*", VideoManagerConstants.KEEPLIVEKEY_PREFIX));
for (int i = 0; i < onlineDevices.size(); i++) {
String key = (String) onlineDevices.get(i);
redis.del(key);
}
}
}

Loading…
Cancel
Save