diff --git a/naming/src/main/java/com/alibaba/nacos/naming/core/v2/index/ServiceStorage.java b/naming/src/main/java/com/alibaba/nacos/naming/core/v2/index/ServiceStorage.java index ab1dc5bf7..02738926d 100644 --- a/naming/src/main/java/com/alibaba/nacos/naming/core/v2/index/ServiceStorage.java +++ b/naming/src/main/java/com/alibaba/nacos/naming/core/v2/index/ServiceStorage.java @@ -81,8 +81,9 @@ public class ServiceStorage { if (!ServiceManager.getInstance().containSingleton(service)) { return result; } - result.setHosts(getAllInstancesFromIndex(service)); - serviceDataIndexes.put(service, result); + Service singleton = ServiceManager.getInstance().getSingleton(service); + result.setHosts(getAllInstancesFromIndex(singleton)); + serviceDataIndexes.put(singleton, result); return result; }