Bug: Crash when a transaction fails due to io issues.
This commit is contained in:
parent
34de2bdcd5
commit
74b927b622
|
@ -15,7 +15,7 @@ type EasyClient struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewClient(conf EasyConfig) (*EasyClient, error) {
|
func NewClient(conf EasyConfig) (*EasyClient, error) {
|
||||||
config, err := conf.prepare()
|
config, err := conf.prepare()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -119,7 +119,6 @@ func (ez *EasyClient) WatchOnce(key string, timeoutSeconds int) (*Pair, error) {
|
||||||
return nil, errors.New("Timed out watching key.")
|
return nil, errors.New("Timed out watching key.")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
type Txn struct {
|
type Txn struct {
|
||||||
ez *EasyClient
|
ez *EasyClient
|
||||||
If *Cmps
|
If *Cmps
|
||||||
|
@ -212,11 +211,11 @@ func (txn *Txn) Commit() error {
|
||||||
t := ez.Client.Txn(ctx)
|
t := ez.Client.Txn(ctx)
|
||||||
resp, err := t.If(txn.If.slice...).Then(txn.Then.slice...).Else(txn.Else.slice...).Commit()
|
resp, err := t.If(txn.If.slice...).Then(txn.Then.slice...).Else(txn.Else.slice...).Commit()
|
||||||
cancel()
|
cancel()
|
||||||
txn.Success = resp.Succeeded
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
txn.Err = err
|
txn.Err = err
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
txn.Success = resp.Succeeded
|
||||||
result := make([]*Pair, 0, 4)
|
result := make([]*Pair, 0, 4)
|
||||||
for _, r := range resp.Responses {
|
for _, r := range resp.Responses {
|
||||||
if rr := r.GetResponseRange(); rr != nil {
|
if rr := r.GetResponseRange(); rr != nil {
|
||||||
|
|
Loading…
Reference in New Issue