You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "ghostly72 (via GitHub)" <gi...@apache.org> on 2026/01/10 14:50:26 UTC

Re: [I] [Feature] Service Discovery support local cache when registry is unavailable [dubbo]

ghostly72 commented on issue #13856:
URL: https://github.com/apache/dubbo/issues/13856#issuecomment-3732930473

   hi
   right now, in the pr i created for this, my code goes like (inside abstractregistry.java)
   ```
   if(localCacheEnabled && !isAvailable){
               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;
               }
           }
   ```
   but this fails tests because i think `isAvailable()` returns false not only when the registry crashes, but also when:
   -the registry hasn’t connected yet (say during startup)
   -the client object is null (like in tests or mocks)
   -the registry was shut down gracefully


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org