Skip to content

Commit

Permalink
Added WithRequireLeader() to etcd v3 watch
Browse files Browse the repository at this point in the history
  • Loading branch information
thrawn01 committed Aug 23, 2018
1 parent 8d1f2fd commit 8b4dad1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 26 deletions.
29 changes: 4 additions & 25 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion engine/etcdng/v3/etcd.go
Expand Up @@ -598,7 +598,8 @@ func (n *ng) Subscribe(changes chan interface{}, afterIdx uint64, cancelC chan s
defer watcher.Close()

log.Infof("begin watching: etcd revision %d", afterIdx)
watchChan := watcher.Watch(n.context, n.etcdKey, etcd.WithRev(int64(afterIdx)), etcd.WithPrefix())
watchChan := watcher.Watch(etcd.WithRequireLeader(n.context),
n.etcdKey, etcd.WithRev(int64(afterIdx)), etcd.WithPrefix())

for response := range watchChan {
if response.Canceled {
Expand Down

0 comments on commit 8b4dad1

Please sign in to comment.