listener bugfix (#5079)

This commit is contained in:
nov.lzf 2021-03-12 10:30:52 +08:00 committed by GitHub
parent 711afc7bac
commit 481d25a6c7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -16,6 +16,7 @@
package com.alibaba.nacos.config.server.controller; package com.alibaba.nacos.config.server.controller;
import com.alibaba.nacos.common.utils.CollectionUtils;
import com.alibaba.nacos.config.server.constant.Constants; import com.alibaba.nacos.config.server.constant.Constants;
import com.alibaba.nacos.config.server.model.SampleResult; import com.alibaba.nacos.config.server.model.SampleResult;
import com.alibaba.nacos.config.server.remote.ConfigChangeListenContext; import com.alibaba.nacos.config.server.remote.ConfigChangeListenContext;
@ -102,7 +103,7 @@ public class CommunicationController {
// rpc listeners. // rpc listeners.
String groupKey = GroupKey2.getKey(dataId, group, tenant); String groupKey = GroupKey2.getKey(dataId, group, tenant);
Set<String> listenersClients = configChangeListenContext.getListeners(groupKey); Set<String> listenersClients = configChangeListenContext.getListeners(groupKey);
SampleResult rpcSample = new SampleResult(); if (CollectionUtils.isNotEmpty(listenersClients)) {
Map<String, String> lisentersGroupkeyStatus = new HashMap<String, String>(listenersClients.size(), 1); Map<String, String> lisentersGroupkeyStatus = new HashMap<String, String>(listenersClients.size(), 1);
for (String connectionId : listenersClients) { for (String connectionId : listenersClients) {
Connection client = connectionManager.getConnection(connectionId); Connection client = connectionManager.getConnection(connectionId);
@ -114,6 +115,8 @@ public class CommunicationController {
} }
} }
result.getLisentersGroupkeyStatus().putAll(lisentersGroupkeyStatus); result.getLisentersGroupkeyStatus().putAll(lisentersGroupkeyStatus);
}
return result; return result;
} }