Commit 9a15f298 by Future

消息丢失排查日志添加

parent 2e1395be
......@@ -128,15 +128,21 @@ public class ChannelSender {
String msgJson = JsonUtils.encodeJson(responseModel);
List<ClientChannelInfo> channelInfos = userStateCacheManager.findOnlineInfosByClientId(toClientId);
log.info("获取在线用户入参 {}, 结果 {}", toClientId, JSON.toJSONString(channelInfos));
// 一个用户存在多端的情况,所以先进行分类,key是ip地址,value是channel的列表
Map<String, List<ClientChannelInfo>> ipChannels = channelInfos.stream().collect(Collectors.groupingBy(ClientChannelInfo::getLanIp));
log.info("分组在线用户入参 {}, 结果 {}", toClientId, JSON.toJSONString(ipChannels));
for (Map.Entry<String, List<ClientChannelInfo>> channelInfoEntry : ipChannels.entrySet()) {
log.info("在线用户入参 {}, 具体ip结果 {}", toClientId, JSON.toJSONString(channelInfoEntry));
// 是否为当前机器的ip
if (GetIpUtils.getlanIp().equals(channelInfoEntry.getKey())) {
// 调用本地下发
log.info("在线用户入参 {}, 具体ip结果 {}", toClientId, JSON.toJSONString(channelInfoEntry));
for(ClientChannelInfo clientChannelInfo : channelInfoEntry.getValue()) {
this.sendMsgLocal(toClientId, clientChannelInfo.getPlatform(), msgJson);
}
......@@ -217,8 +223,10 @@ public class ChannelSender {
* @return
*/
private boolean sendMsgLocal(String key, String msgJsonStr) {
log.info("消息推送 key {} 内容 {}", key, msgJsonStr);
ClientInfo clientInfo = ChannelManager.SESSION_INFO_MAP.get(key);
if (clientInfo == null) {
log.info("消息推送 key {} 本地map取设备信息为空", key);
return false;
}
......@@ -229,7 +237,7 @@ public class ChannelSender {
}
// 判断连接是否断开
if (nioSocketChannel.isShutdown()) {
log.warn("writeData 已连接断开: {}\n channelId: {}", msgJsonStr, nioSocketChannel.id().asLongText());
log.info("writeData 已连接断开: {}\n channelId: {}", msgJsonStr, nioSocketChannel.id().asLongText());
return false;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment