Skip to content

Commit

Permalink
Merge pull request #168 from hxmhlt/fix_zk_hignmem_bug
Browse files Browse the repository at this point in the history
Fix:zk high memory bug
  • Loading branch information
AlexStocks authored Aug 19, 2019
2 parents f98d8d1 + 18a9a4c commit 83b3b9c
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions remoting/zookeeper/listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 83b3b9c

Please sign in to comment.