AlexStocks commented on code in PR #389:
URL: https://github.com/apache/dubbo-go-pixiu/pull/389#discussion_r846574632


##########
pkg/adapter/dubboregistry/registry/nacos/service_listener.go:
##########
@@ -58,11 +64,76 @@ func newNacosSrvListener(url *dubboCommon.URL, client 
naming_client.INamingClien
                client:          client,
                exit:            make(chan struct{}),
                adapterListener: adapterListener,
+               instanceMap:     map[string]nacosModel.Instance{},
        }
 }
 
-func (z *serviceListener) Notify(e *dubboRegistry.ServiceEvent) {
-       bkConfig, methods, location, err := 
registry.ParseDubboString(e.Service.String())
+func (z *serviceListener) Callback(services []nacosModel.SubscribeService, err 
error) {
+       if err != nil {
+               logger.Errorf("nacos subscribe callback error:%s", err.Error())
+               return
+       }
+
+       addInstances := make([]nacosModel.Instance, 0, len(services))
+       delInstances := make([]nacosModel.Instance, 0, len(services))
+       updateInstances := make([]nacosModel.Instance, 0, len(services))
+       newInstanceMap := make(map[string]nacosModel.Instance, len(services))
+
+       z.cacheLock.Lock()

Review Comment:
   这个锁的粒度太大了,增大出现死锁的概率,且导致整体很低效。下面的函数动作确定都在lock scope 内吗?



-- 
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-unsubscr...@dubbo.apache.org

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


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

Reply via email to