From bf1c06f82be824223148448f9206fb40300bd333 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=83=A1=E4=BF=8A?= <510830970@qq.com> Date: Fri, 10 Jun 2022 10:06:37 +0800 Subject: [PATCH] Solve the bug: the persistent instance becomes a temporary instance after the console operation goes offline (#8517) --- .../alibaba/nacos/naming/core/v2/index/ServiceStorage.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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; }