You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2023/01/05 06:04:43 UTC
[GitHub] [dubbo-go] AlexStocks commented on a diff in pull request #2168: Fix: service discovery registry notify before return
AlexStocks commented on code in PR #2168:
URL: https://github.com/apache/dubbo-go/pull/2168#discussion_r1062135621
##########
registry/servicediscovery/service_discovery_registry.go:
##########
@@ -230,7 +231,28 @@ func (s *serviceDiscoveryRegistry) Subscribe(url *common.URL, notify registry.No
}
// LoadSubscribeInstances load subscribe instance
-func (s *serviceDiscoveryRegistry) LoadSubscribeInstances(_ *common.URL, _ registry.NotifyListener) error {
+func (s *serviceDiscoveryRegistry) LoadSubscribeInstances(url *common.URL, notify registry.NotifyListener) error {
+ appName := url.GetParam(constant.ApplicationKey, url.Username)
+ instances := s.serviceDiscovery.GetInstances(appName)
+ for _, instance := range instances {
+ if instance.GetMetadata() == nil {
+ logger.Warnf("Instance metadata is nil: %s", instance.GetHost())
+ continue
+ }
+ revision := instance.GetMetadata()[constant.ExportedServicesRevisionPropertyName]
Review Comment:
这里不加个 ok 判断吗?这么铁定能拿到值?
--
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