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 2022/12/28 15:33:53 UTC

[GitHub] [dubbo-go] Lvnszn commented on a diff in pull request #2152: Fix: Replace assignment behavior with copy operation to avoid OOM problem

Lvnszn commented on code in PR #2152:
URL: https://github.com/apache/dubbo-go/pull/2152#discussion_r1058427982


##########
remoting/zookeeper/listener.go:
##########
@@ -63,16 +63,13 @@ func NewZkEventListener(client *gxzookeeper.ZookeeperClient) *ZkEventListener {
 
 // ListenServiceNodeEvent listen a path node event
 func (l *ZkEventListener) ListenServiceNodeEvent(zkPath string, listener remoting.DataListener) {
-	l.wg.Add(1)
-	go func(zkPath string, listener remoting.DataListener) {
-		if l.listenServiceNodeEvent(zkPath, listener) {
-			listener.DataChange(remoting.Event{Path: zkPath, Action: remoting.EventTypeDel})
-			l.pathMapLock.Lock()
-			delete(l.pathMap, zkPath)
-			l.pathMapLock.Unlock()
-		}
-		logger.Warnf("ListenServiceNodeEvent->listenSelf(zk path{%s}) goroutine exit now", zkPath)
-	}(zkPath, listener)
+	if l.listenServiceNodeEvent(zkPath, listener) {

Review Comment:
   When calling this function, it is started asynchronously, so there is no problem with always posting



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