use method getAllInstances instead of selectInstance to get instance

pull/36/head
flystar32 7 years ago
parent 2b953bae69
commit 541a4bac9d

@ -86,7 +86,7 @@ public class NacosDiscoveryClient implements DiscoveryClient {
public List<ServiceInstance> getInstances(String serviceId) {
try {
NamingService namingService = nacosRegistration.getNacosNamingService();
List<Instance> instances = namingService.selectInstances(serviceId, true);
List<Instance> instances = namingService.getAllInstances(serviceId);
return hostToServiceInstanceList(instances, serviceId);
}
catch (Exception e) {
@ -115,7 +115,9 @@ public class NacosDiscoveryClient implements DiscoveryClient {
List<Instance> instances, String serviceId) {
List<ServiceInstance> result = new ArrayList<ServiceInstance>(instances.size());
for (Instance instance : instances) {
result.add(hostToServiceInstance(instance, serviceId));
if (instance.isHealthy()) {
result.add(hostToServiceInstance(instance, serviceId));
}
}
return result;
}

Loading…
Cancel
Save