Skip to content

Commit

Permalink
Another implementation, the effect remains unchanged
Browse files Browse the repository at this point in the history
  • Loading branch information
guoquanwei committed May 10, 2024
1 parent ae36077 commit b1aa0da
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions contrib/registry/nacos/watcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,14 +41,16 @@ func newWatcher(ctx context.Context, cli naming_client.INamingClient, serviceNam
Clusters: clusters,
GroupName: groupName,
SubscribeCallback: func(services []model.SubscribeService, err error) {
if len(w.watchChan) == 0 {
w.watchChan <- struct{}{}
select {
case w.watchChan <- struct{}{}:
default:
}
},
}
e := w.cli.Subscribe(w.subscribeParam)
if len(w.watchChan) == 0 {
w.watchChan <- struct{}{}
select {
case w.watchChan <- struct{}{}:
default:
}
return w, e
}
Expand Down

0 comments on commit b1aa0da

Please sign in to comment.