Skip to content

Commit

Permalink
Merge pull request #10153 from funny-falcon/fix-client-mutex-lock-10111
Browse files Browse the repository at this point in the history
clientv3/concurrency.Mutex.Lock() - preserve invariant
  • Loading branch information
xiang90 committed Oct 8, 2018
2 parents 7c33e3d + 64e8b2e commit b046a37
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions clientv3/concurrency/mutex.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,10 @@ func (m *Mutex) Lock(ctx context.Context) error {

// wait for deletion revisions prior to myKey
hdr, werr := waitDeletes(ctx, client, m.pfx, m.myRev-1)
// release lock key if cancelled
select {
case <-ctx.Done():
// release lock key if wait failed
if werr != nil {
m.Unlock(client.Ctx())
default:
} else {
m.hdr = hdr
}
return werr
Expand Down

0 comments on commit b046a37

Please sign in to comment.