diff --git a/contrib/recipes/double_barrier.go b/contrib/recipes/double_barrier.go index 1d0fcacd1..1fe0a191e 100644 --- a/contrib/recipes/double_barrier.go +++ b/contrib/recipes/double_barrier.go @@ -74,6 +74,9 @@ func (b *DoubleBarrier) Enter() error { // Leave waits for "count" processes to leave the barrier then returns func (b *DoubleBarrier) Leave() error { resp, err := b.client.Get(b.ctx, b.key+"/waiters", clientv3.WithPrefix()) + if err != nil { + return err + } if len(resp.Kvs) == 0 { return nil } diff --git a/contrib/recipes/stm.go b/contrib/recipes/stm.go index 8c271944c..c7accfa6a 100644 --- a/contrib/recipes/stm.go +++ b/contrib/recipes/stm.go @@ -91,6 +91,9 @@ func (s *STM) commit() (ok bool, rr error) { puts = append(puts, v3.OpPut(k, v)) } txnresp, err := s.client.Txn(context.TODO()).If(cmps...).Then(puts...).Commit() + if err != nil { + return false, err + } return txnresp.Succeeded, err }