mirror of
https://gitee.com/mirrors/Spring-Cloud-Alibaba.git
synced 2021-06-26 13:25:11 +08:00
use method getAllInstances instead of selectInstance to get instance
This commit is contained in:
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…
x
Reference in New Issue
Block a user