1
0
mirror of https://gitee.com/mirrors/Spring-Cloud-Alibaba.git synced 2021-06-26 13:25:11 +08:00

修复当实例不在默认分组下时获取不到实例状态的BUG

This commit is contained in:
HuGuirong 2021-06-10 20:27:22 +08:00
parent 139d793302
commit 4786725e8e

View File

@ -159,8 +159,9 @@ public class NacosServiceRegistry implements ServiceRegistry<Registration> {
public Object getStatus(Registration registration) { public Object getStatus(Registration registration) {
String serviceName = registration.getServiceId(); String serviceName = registration.getServiceId();
String group = nacosDiscoveryProperties.getGroup();
try { try {
List<Instance> instances = namingService().getAllInstances(serviceName); List<Instance> instances = namingService().getAllInstances(serviceName, group);
for (Instance instance : instances) { for (Instance instance : instances) {
if (instance.getIp().equalsIgnoreCase(nacosDiscoveryProperties.getIp()) if (instance.getIp().equalsIgnoreCase(nacosDiscoveryProperties.getIp())
&& instance.getPort() == nacosDiscoveryProperties.getPort()) { && instance.getPort() == nacosDiscoveryProperties.getPort()) {