Merge pull request #10162 from jingyih/automated-cherry-pick-of-#10153-origin-release-3.2

clientv3: automated cherry pick of #10153 to release-3.2
This commit is contained in:
Jingyi Hu 2018-10-08 18:38:02 -07:00 committed by GitHub
commit afa5beda46
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -69,11 +69,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