Skip to content

Commit

Permalink
etcdctl/ctlv3: enable 'require-leader' for 'watch' command
Browse files Browse the repository at this point in the history
To help with network partition cases.

Signed-off-by: Gyu-Ho Lee <[email protected]>
  • Loading branch information
gyuho committed Oct 9, 2017
1 parent ed92420 commit d44f7d5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion etcdctl/ctlv3/command/watch_command.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ func getWatchChan(c *clientv3.Client, args []string) (clientv3.WatchChan, error)
if watchPrevKey {
opts = append(opts, clientv3.WithPrevKV())
}
return c.Watch(context.TODO(), key, opts...), nil
return c.Watch(clientv3.WithRequireLeader(context.Background()), key, opts...), nil
}

func printWatchCh(ch clientv3.WatchChan) {
Expand Down

0 comments on commit d44f7d5

Please sign in to comment.