diff --git a/remoting/zookeeper/listener.go b/remoting/zookeeper/listener.go index 3df87ed4f603956a653cec692031dee94639de16..d9efd4fed1db7bac69ac5368b08cb0bd28aa7dea 100644 --- a/remoting/zookeeper/listener.go +++ b/remoting/zookeeper/listener.go @@ -208,6 +208,20 @@ func (l *ZkEventListener) listenDirEvent(zkPath string, listener remoting.DataLi // listen l service node dubboPath := path.Join(zkPath, c) + + //Save the path to avoid listen repeatly + l.pathMapLock.Lock() + _, ok := l.pathMap[dubboPath] + l.pathMapLock.Unlock() + if ok { + logger.Warnf("@zkPath %s has already been listened.", zkPath) + continue + } + + l.pathMapLock.Lock() + l.pathMap[dubboPath] = struct{}{} + l.pathMapLock.Unlock() + content, _, err := l.client.Conn.Get(dubboPath) if err != nil { logger.Errorf("Get new node path {%v} 's content error,message is {%v}", dubboPath, perrors.WithStack(err))