Skip to content

Commit

Permalink
Update registry.go
Browse files Browse the repository at this point in the history
  • Loading branch information
rushuinet committed Sep 7, 2020
1 parent c487351 commit 980bd1a
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,9 @@ func (z *ZkRegistry) watchNode(serviceName string, wg *sync.WaitGroup) {
for {
nodeIds, _, events, err := conn.ChildrenW(path)
if err != nil {
log.Println(err.Error())
log.Println("watch[" + serviceName + "]err:" + err.Error())
time.Sleep(time.Duration(z.opts.timeout) * time.Second)
continue
}
//获取信息
var newNodes = make(map[string]bool)
Expand All @@ -170,7 +172,7 @@ func (z *ZkRegistry) watchNode(serviceName string, wg *sync.WaitGroup) {
continue
}
newNodes[nodeId] = true
if node.Id == "" { //兼容node没有定义ID的情况
if node.Id == "" { //兼容node没有定义ID的情况
node.Id = nodeId
}
err = z.setServiceNode(serviceName, &node)
Expand Down

0 comments on commit 980bd1a

Please sign in to comment.