Skip to content

Commit d44f7d5

Browse files
committed
etcdctl/ctlv3: enable 'require-leader' for 'watch' command
To help with network partition cases. Signed-off-by: Gyu-Ho Lee <gyuhox@gmail.com>
1 parent ed92420 commit d44f7d5

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

etcdctl/ctlv3/command/watch_command.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ func getWatchChan(c *clientv3.Client, args []string) (clientv3.WatchChan, error)
125125
if watchPrevKey {
126126
opts = append(opts, clientv3.WithPrevKV())
127127
}
128-
return c.Watch(context.TODO(), key, opts...), nil
128+
return c.Watch(clientv3.WithRequireLeader(context.Background()), key, opts...), nil
129129
}
130130

131131
func printWatchCh(ch clientv3.WatchChan) {

0 commit comments

Comments
 (0)