Skip to content

Commit

Permalink
For etcd client failover all requests should require a leader.
Browse files Browse the repository at this point in the history
-This workaround is mentioned here:  core/etcd - etcd-io/etcd#8660
  • Loading branch information
adityadani committed May 26, 2018
1 parent b699888 commit b063e8c
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions etcd/v3/kv_etcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ func (et *etcdKV) Capabilities() int {
}

func (et *etcdKV) Context() (context.Context, context.CancelFunc) {
return context.WithTimeout(context.Background(), defaultKvRequestTimeout)
return context.WithTimeout(getContextWithLeaderRequirement(), defaultKvRequestTimeout)
}

func (et *etcdKV) MaintenanceContext() (context.Context, context.CancelFunc) {
Expand Down Expand Up @@ -904,7 +904,7 @@ func (et *etcdKV) watchStart(
_ = cb(key, opaque, nil, kvdb.ErrWatchStopped)
return
}
ctx, watchCancel := context.WithCancel(context.Background())
ctx, watchCancel := et.Context()
watchRet := make(chan error)
watchChan := et.kvClient.Watch(ctx, key, opts...)
watchQ := newWatchQ(opaque, cb, watchRet)
Expand Down

0 comments on commit b063e8c

Please sign in to comment.