This is an automated email from the ASF dual-hosted git repository.

liujun pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/dubbo-kubernetes.git


The following commit(s) were added to refs/heads/master by this push:
     new 950f2aa0 fix interface merge
950f2aa0 is described below

commit 950f2aa0135e9de802f7fb0b50f8586cdb06b9c6
Author: chickenlj <[email protected]>
AuthorDate: Sun Oct 20 16:41:45 2024 +0800

    fix interface merge
---
 pkg/core/registry/interface_context.go | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/pkg/core/registry/interface_context.go 
b/pkg/core/registry/interface_context.go
index e259a85a..d7ffb480 100644
--- a/pkg/core/registry/interface_context.go
+++ b/pkg/core/registry/interface_context.go
@@ -139,13 +139,17 @@ func MergeInstances(insMap1 
map[string][]registry.ServiceInstance, insMap2 map[s
                existingInstances := instances[app]
                if existingInstances != nil {
                        for _, i2 := range newServiceInstances {
-                               for _, i3 := range existingInstances {
+                               find := false
+                               for _, i3 := range insMap1[app] {
                                        if i2.GetAddress() == i3.GetAddress() {
                                                
i3.GetMetadata()["registry-type"] = "all"
-                                       } else {
-                                               existingInstances = 
append(existingInstances, i2)
+                                               find = true
                                        }
                                }
+
+                               if !find {
+                                       existingInstances = 
append(existingInstances, i2)
+                               }
                        }
                        instances[app] = existingInstances
                } else {

Reply via email to