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

pull/115/head
64850858 2021-06-18 19:44:55 +08:00
parent 513b810631
commit d09ee0c2ff
4 changed files with 17 additions and 1 deletions

View File

@ -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_";

View File

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

View File

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

View File

@ -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);
}
}
}