This is an automated email from the ASF dual-hosted git repository.
liubao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/servicecomb-java-chassis.git
The following commit(s) were added to refs/heads/master by this push:
new 8cedd077e [SCB-2895]The findServices method returns data errors (#4674)
8cedd077e is described below
commit 8cedd077e0df968a4f5eeedd85efcd71bf48aae2
Author: felixgis14 <[email protected]>
AuthorDate: Thu Jan 9 20:37:47 2025 +0800
[SCB-2895]The findServices method returns data errors (#4674)
---
.../org/apache/servicecomb/registry/consul/ConsulDiscovery.java | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git
a/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/ConsulDiscovery.java
b/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/ConsulDiscovery.java
index 855f2348f..c8229ad9c 100644
---
a/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/ConsulDiscovery.java
+++
b/service-registry/registry-consul/src/main/java/org/apache/servicecomb/registry/consul/ConsulDiscovery.java
@@ -84,8 +84,11 @@ public class ConsulDiscovery implements
Discovery<ConsulDiscoveryInstance> {
@Override
public List<String> findServices(String application) {
LOGGER.info("ConsulDiscovery findServices(application={})", application);
- Map<String, Service> services = consulClient.agentClient().getServices();
- return Lists.newArrayList(services.keySet());
+ Map<String, List<String>> response =
consulClient.catalogClient().getServices().getResponse();
+ if (!CollectionUtils.isEmpty(response)) {
+ return Lists.newArrayList(response.keySet());
+ }
+ return Lists.newArrayList();
}
@Override