ghostly72 commented on code in PR #15873:
URL: https://github.com/apache/dubbo/pull/15873#discussion_r2635338785
##########
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:
```
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()+" : "+cached.size());
}
}catch(Throwable t){
logger.warn(INTERNAL_ERROR,"failed to load local
cache","","Failed to load chached registry data for "+url,t);
throw t;
}
}
```
from what i understood, i think cached list being not empty simply refers to
some cached urls being available and the functionality checking for the
unavailability of registry is taken care of by
` if(localcacheenbled)`
--
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]