From 3552420dfd69c7c955266e7b5403ea994213d1b4 Mon Sep 17 00:00:00 2001 From: Anthony Romano Date: Sun, 28 Aug 2016 19:40:38 -0700 Subject: [PATCH] clientv3: set failfast=false on read-only txns --- clientv3/txn.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/clientv3/txn.go b/clientv3/txn.go index a451e33ac..a61decd64 100644 --- a/clientv3/txn.go +++ b/clientv3/txn.go @@ -19,6 +19,7 @@ import ( pb "github.com/coreos/etcd/etcdserver/etcdserverpb" "golang.org/x/net/context" + "google.golang.org/grpc" ) // Txn is the interface that wraps mini-transactions. @@ -152,7 +153,12 @@ func (txn *txn) Commit() (*TxnResponse, error) { func (txn *txn) commit() (*TxnResponse, error) { r := &pb.TxnRequest{Compare: txn.cmps, Success: txn.sus, Failure: txn.fas} - resp, err := txn.kv.remote.Txn(txn.ctx, r) + + var opts []grpc.CallOption + if !txn.isWrite { + opts = []grpc.CallOption{grpc.FailFast(false)} + } + resp, err := txn.kv.remote.Txn(txn.ctx, r, opts...) if err != nil { return nil, err }