优化Catalog接收,提升大量设备同时接入性能

This commit is contained in:
648540858
2024-10-30 14:21:32 +08:00
parent 374548ab6e
commit dd6beba843
4 changed files with 72 additions and 56 deletions

View File

@@ -37,7 +37,6 @@ import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
/**
* @author lin
@@ -470,6 +469,7 @@ public class DeviceChannelServiceImpl implements IDeviceChannelService {
if (CollectionUtils.isEmpty(deviceChannelList)) {
return false;
}
System.out.println("size: " + deviceChannelList.size());
List<DeviceChannel> allChannels = channelMapper.queryAllChannelsForRefresh(deviceDbId);
Map<String,DeviceChannel> allChannelMap = new HashMap<>();
if (!allChannels.isEmpty()) {

View File

@@ -335,12 +335,12 @@ public class DeviceServiceImpl implements IDeviceService {
try {
sipCommander.catalogQuery(device, sn, event -> {
String errorMsg = String.format("同步通道失败,错误码: %s, %s", event.statusCode, event.msg);
catalogResponseMessageHandler.setChannelSyncEnd(device.getDeviceId(), errorMsg);
catalogResponseMessageHandler.setChannelSyncEnd(device.getDeviceId(), sn, errorMsg);
});
} catch (SipException | InvalidArgumentException | ParseException e) {
log.error("[同步通道], 信令发送失败:{}", e.getMessage() );
String errorMsg = String.format("同步通道失败,信令发送失败: %s", e.getMessage());
catalogResponseMessageHandler.setChannelSyncEnd(device.getDeviceId(), errorMsg);
catalogResponseMessageHandler.setChannelSyncEnd(device.getDeviceId(), sn, errorMsg);
}
}