ghostly72 commented on code in PR #15873:
URL: https://github.com/apache/dubbo/pull/15873#discussion_r2635355483


##########
dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/support/AbstractRegistry.java:
##########
@@ -456,6 +463,24 @@ public void subscribe(URL url, NotifyListener listener) {
         Set<NotifyListener> listeners =
                 ConcurrentHashMapUtils.computeIfAbsent(subscribed, url, n -> 
new ConcurrentHashSet<>());
         listeners.add(listener);
+        if (localCacheEnabled) {
+            try {
+                List<URL> cached = getCacheUrls(url);
+                if (CollectionUtils.isNotEmpty(cached)) {
+                    listener.notify(cached);
+                    logger.info("Registry unavailable or not yet ready. Loaded 
cached URLs for " + url.getServiceKey()

Review Comment:
   and now looking at it i think instead of
   `if(localCacheEnabled) `
   
   it should be 
   `if(localCacheEnabled and !isAvailable())` ?



-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to