From d8c34bb8630f5c696d6d5b4d90febc9932f4396e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BE=84=E6=BD=AD?= Date: Wed, 27 Sep 2023 09:30:39 +0800 Subject: [PATCH] fix the delete service issue in nacos registry (#553) --- registry/memory/cache.go | 2 +- registry/nacos/v2/watcher.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/registry/memory/cache.go b/registry/memory/cache.go index b8ed2a373a..9df0e31dd0 100644 --- a/registry/memory/cache.go +++ b/registry/memory/cache.go @@ -122,8 +122,8 @@ func (s *store) DeleteServiceEntryWrapper(service string) { if data, exist := s.sew[service]; exist { s.toBeDeleted = append(s.toBeDeleted, data) + s.deferedDelete[service] = struct{}{} } - s.deferedDelete[service] = struct{}{} } // should only be called when reconcile is done diff --git a/registry/nacos/v2/watcher.go b/registry/nacos/v2/watcher.go index 158cdb49a8..5ce3ef00f8 100644 --- a/registry/nacos/v2/watcher.go +++ b/registry/nacos/v2/watcher.go @@ -484,7 +484,7 @@ func (w *watcher) Stop() { } // clean the cache - suffix := strings.Join([]string{s[0], w.NacosNamespace, w.Type}, common.DotSeparator) + suffix := strings.Join([]string{s[0], w.NacosNamespace, "nacos"}, common.DotSeparator) suffix = strings.ReplaceAll(suffix, common.Underscore, common.Hyphen) host := strings.Join([]string{s[1], suffix}, common.DotSeparator) w.cache.DeleteServiceEntryWrapper(host)