justxuewei commented on code in PR #2152: URL: https://github.com/apache/dubbo-go/pull/2152#discussion_r1058036834
########## 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: If `go func` is removed from here, the code will be synchronized and blocked until `l.listenServiceNodeEvent` returns. Why should it be removed? -- 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