Don't send a canceled context to Unlock (#20409)

AFAICT we send a canceled context to unlock (and thereby releaseAll). This will cause network calls to fail.

Instead use background and add 30s timeout.
This commit is contained in:
Klaus Post
2024-09-09 08:49:49 -07:00
committed by GitHub
parent fb24bcfee0
commit b1c849bedc
2 changed files with 3 additions and 1 deletions

View File

@@ -643,6 +643,8 @@ func (dm *DRWMutex) Unlock(ctx context.Context) {
// Do async unlocking.
// This means unlock will no longer block on the network or missing quorum.
go func() {
ctx, done := context.WithTimeout(ctx, drwMutexUnlockCallTimeout)
defer done()
for !releaseAll(ctx, dm.clnt, tolerance, owner, &locks, isReadLock, restClnts, dm.Names...) {
time.Sleep(time.Duration(dm.rng.Float64() * float64(dm.lockRetryMinInterval)))
if time.Since(started) > dm.clnt.Timeouts.UnlockCall {