clientv3/concurrency: do not swallow error (#11458)

This commit is contained in:
Xiang Li 2020-04-06 12:07:59 -07:00 committed by GitHub
parent be103ea558
commit b41711276e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -82,12 +82,11 @@ func (m *Mutex) Lock(ctx context.Context) error {
client := m.s.Client() client := m.s.Client()
// wait for deletion revisions prior to myKey // wait for deletion revisions prior to myKey
// TODO: early termination if the session key is deleted before other session keys with smaller revisions. // TODO: early termination if the session key is deleted before other session keys with smaller revisions.
hdr, werr := waitDeletes(ctx, client, m.pfx, m.myRev-1) _, werr := waitDeletes(ctx, client, m.pfx, m.myRev-1)
// release lock key if wait failed // release lock key if wait failed
if werr != nil { if werr != nil {
m.Unlock(client.Ctx()) m.Unlock(client.Ctx())
} else { return werr
m.hdr = hdr
} }
// make sure the session is not expired, and the owner key still exists. // make sure the session is not expired, and the owner key still exists.