添加设备离线原因
This commit is contained in:
@@ -24,7 +24,7 @@ public interface IDeviceService {
|
||||
* 设备下线
|
||||
* @param deviceId 设备编号
|
||||
*/
|
||||
void offline(String deviceId);
|
||||
void offline(String deviceId, String reason);
|
||||
|
||||
/**
|
||||
* 添加目录订阅
|
||||
|
||||
@@ -156,12 +156,12 @@ public class DeviceServiceImpl implements IDeviceService {
|
||||
// 刷新过期任务
|
||||
String registerExpireTaskKey = VideoManagerConstants.REGISTER_EXPIRE_TASK_KEY_PREFIX + device.getDeviceId();
|
||||
// 如果第一次注册那么必须在60 * 3时间内收到一个心跳,否则设备离线
|
||||
dynamicTask.startDelay(registerExpireTaskKey, ()-> offline(device.getDeviceId()), device.getKeepaliveIntervalTime() * 1000 * 3);
|
||||
dynamicTask.startDelay(registerExpireTaskKey, ()-> offline(device.getDeviceId(), "首次注册后未能收到心跳"), device.getKeepaliveIntervalTime() * 1000 * 3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void offline(String deviceId) {
|
||||
logger.error("[设备离线], device:{}", deviceId);
|
||||
public void offline(String deviceId, String reason) {
|
||||
logger.error("[设备离线],{}, device:{}", reason, deviceId);
|
||||
Device device = deviceMapper.getDeviceByDeviceId(deviceId);
|
||||
if (device == null) {
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user