bzp2010 commented on code in PR #10950:
URL: https://github.com/apache/apisix/pull/10950#discussion_r1676774015


##########
apisix/discovery/nacos/init.lua:
##########
@@ -352,16 +359,35 @@ local function fetch_full_registry(premature)
         ::CONTINUE::
     end
     local new_apps_md5sum = ngx.md5(core.json.encode(up_apps))
-    local old_apps_md5sum = ngx.md5(core.json.encode(applications))
+    local old_apps_md5sum = ngx.md5(core.json.encode(applications[nacos_name]))
     if new_apps_md5sum == old_apps_md5sum then
         return
     end
-    applications = up_apps
+    applications[nacos_name] = up_apps
+    local arg = {
+        name = nacos_name,
+        data = up_apps
+    }
     local ok, err = events:post(events_list._source, events_list.updating,
-                                applications)
+            arg)
     if not ok then
         log.error("post_event failure with ", events_list._source,
-                  ", update application error: ", err)
+                ", update application error: ", err)
+    end
+
+
+end
+
+local function fetch_full_registry(premature)
+    if premature then
+        return
+    end
+    fetch_from_naocs(local_conf.discovery.nacos)
+    local others_nacos = local_conf.discovery.nacos.hosts
+    if others_nacos and #others_nacos > 0 then
+        for _, nacos in ipairs(others_nacos) do
+            fetch_from_naocs(nacos)
+        end
     end

Review Comment:
   The old mode will be deprecated later right?
   Should we treat them as mutually exclusive now (i.e. disable single registry 
mode when multiple registries mode are enabled), I think it's clearer for the 
user rather than mixing them up and suddenly not working anymore when we remove 
it.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to