marsevilspirit commented on code in PR #651:
URL: https://github.com/apache/dubbo-go-pixiu/pull/651#discussion_r1981144553


##########
pkg/adapter/dubboregistry/registry/nacos/interface_listener.go:
##########
@@ -155,44 +154,39 @@ func (z *nacosIntfListener) updateServiceList(serviceList 
[]string) error {
                }
                key := svcInfo.String()
                newServiceMap[key] = true
-               if _, ok := z.serviceInfoMap[key]; !ok {
-
+               if _, ok := n.serviceInfoMap[key]; !ok {
                        url, _ := dubboCommon.NewURL("mock://localhost:8848")
                        url.SetParam(constant.InterfaceKey, 
svcInfo.interfaceName)
                        url.SetParam(constant.GroupKey, svcInfo.group)
                        url.SetParam(constant.VersionKey, svcInfo.version)
-                       l := newNacosSrvListener(url, z.client, 
z.adapterListener)
+                       l := newNacosSrvListener(url, n.client, 
n.adapterListener)
                        l.wg.Add(1)
 
                        svcInfo.listener = l
-                       z.serviceInfoMap[key] = svcInfo
-
-                       go func(v *serviceInfo) {
-                               defer l.wg.Done()
+                       n.serviceInfoMap[key] = svcInfo
 
-                               sub := &vo.SubscribeParam{
-                                       ServiceName:       
getSubscribeName(url),
-                                       SubscribeCallback: l.Callback,
-                                       GroupName:         z.regConf.Group,
-                               }
+                       sub := &vo.SubscribeParam{
+                               ServiceName:       getSubscribeName(url),
+                               SubscribeCallback: l.Callback,
+                               GroupName:         n.regConf.Group,
+                       }
 
-                               if err := z.client.Subscribe(sub); err != nil {
-                                       logger.Errorf("subscribe listener with 
interfaceKey = %s, error = %s", l, err)
-                               }
-                       }(svcInfo)
+                       if err := n.client.Subscribe(sub); err != nil {
+                               logger.Errorf("subscribe listener with 
interfaceKey = %s, error = %s", l, err)

Review Comment:
   Because the Subscribe is no-block func.
   There is no need to keep the goroutine.



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