mirror of https://github.com/etcd-io/dbtester.git
control: make Consul opt more explicit
This commit is contained in:
parent
5cb2b9c74d
commit
c6e00f4637
|
|
@ -107,10 +107,13 @@ func newGetZK(conn *zk.Conn) ReqHandler {
|
||||||
|
|
||||||
func newGetConsul(conn *consulapi.KV) ReqHandler {
|
func newGetConsul(conn *consulapi.KV) ReqHandler {
|
||||||
return func(ctx context.Context, req *request) error {
|
return func(ctx context.Context, req *request) error {
|
||||||
opt := &consulapi.QueryOptions{
|
opt := &consulapi.QueryOptions{}
|
||||||
AllowStale: req.consulOp.staleRead,
|
if req.consulOp.staleRead {
|
||||||
|
opt.AllowStale = true
|
||||||
|
opt.RequireConsistent = false
|
||||||
}
|
}
|
||||||
if !req.consulOp.staleRead {
|
if !req.consulOp.staleRead {
|
||||||
|
opt.AllowStale = false
|
||||||
opt.RequireConsistent = true
|
opt.RequireConsistent = true
|
||||||
}
|
}
|
||||||
_, _, err := conn.Get(req.consulOp.key, opt)
|
_, _, err := conn.Get(req.consulOp.key, opt)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue