Skip to content

Commit

Permalink
clientv3: set failfast=false on read-only txns
Browse files Browse the repository at this point in the history
  • Loading branch information
Anthony Romano committed Aug 29, 2016
1 parent 64ac631 commit 3552420
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion clientv3/txn.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit 3552420

Please sign in to comment.