Skip to content

Commit

Permalink
add some comment
Browse files Browse the repository at this point in the history
Signed-off-by: husharp <jinhao.hu@pingcap.com>
  • Loading branch information
HuSharp committed Jan 19, 2023
1 parent eca0d95 commit 4bd95b5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
19 changes: 9 additions & 10 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -1868,19 +1868,18 @@ func (c *client) WatchGlobalConfig(ctx context.Context, configPath string, revis
}
}()
for {
m, err := res.Recv()
if err != nil {
return
}
arr := make([]GlobalConfigItem, len(m.Changes))
for j, i := range m.Changes {
arr[j] = GlobalConfigItem{i.GetKind(), i.GetName(), i.GetValue()}
}
select {
case <-ctx.Done():
return
default:
m, err := res.Recv()
if err != nil {
return
}
arr := make([]GlobalConfigItem, len(m.Changes))
for j, i := range m.Changes {
arr[j] = GlobalConfigItem{i.GetKind(), i.GetName(), i.GetValue()}
}
globalConfigWatcherCh <- arr
case globalConfigWatcherCh <- arr:
}
}
}()
Expand Down
1 change: 1 addition & 0 deletions server/grpc_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -1920,6 +1920,7 @@ func (s *GrpcServer) LoadGlobalConfig(ctx context.Context, request *pdpb.LoadGlo

// WatchGlobalConfig if the connection of WatchGlobalConfig is end
// or stopped by whatever reason, just reconnect to it.
// Watch on revision which greater than or equal to the required revision.
func (s *GrpcServer) WatchGlobalConfig(req *pdpb.WatchGlobalConfigRequest, server pdpb.PD_WatchGlobalConfigServer) error {
ctx, cancel := context.WithCancel(s.Context())
defer cancel()
Expand Down

0 comments on commit 4bd95b5

Please sign in to comment.