解决启动设置所有设备离线未删除redis记录
parent
513b810631
commit
d09ee0c2ff
|
@ -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_";
|
||||
|
||||
|
|
|
@ -29,5 +29,7 @@ public class SipDeviceRunner implements CommandLineRunner {
|
|||
public void run(String... args) throws Exception {
|
||||
// 设置所有设备离线
|
||||
storager.outlineForAll();
|
||||
// 设置所有设备离线
|
||||
redisCatchStorage.outlineForAll();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -112,4 +112,9 @@ public interface IRedisCatchStorage {
|
|||
* @param deviceId 设备ID
|
||||
*/
|
||||
void clearCatchByDeviceId(String deviceId);
|
||||
|
||||
/**
|
||||
* 设置所有设备离线
|
||||
*/
|
||||
void outlineForAll();
|
||||
}
|
||||
|
|
|
@ -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…
Reference in New Issue