From 5c087bdcad7ec1042e452ad8af43eede32e15a1b Mon Sep 17 00:00:00 2001 From: Anis Elleuch Date: Fri, 10 Mar 2023 00:16:13 +0100 Subject: [PATCH] fix: a cosmetic error reporting with a lock timeout (#16788) --- cmd/namespace-lock.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/namespace-lock.go b/cmd/namespace-lock.go index 825a82e4c..f22b42c01 100644 --- a/cmd/namespace-lock.go +++ b/cmd/namespace-lock.go @@ -170,7 +170,7 @@ func (di *distLockInstance) GetLock(ctx context.Context, timeout *dynamicTimeout RetryInterval: timeout.RetryInterval(), }) { timeout.LogFailure() - cancel() + defer cancel() if err := newCtx.Err(); err == context.Canceled { return LockContext{ctx: ctx, cancel: func() {}}, err } @@ -199,7 +199,7 @@ func (di *distLockInstance) GetRLock(ctx context.Context, timeout *dynamicTimeou RetryInterval: timeout.RetryInterval(), }) { timeout.LogFailure() - cancel() + defer cancel() if err := newCtx.Err(); err == context.Canceled { return LockContext{ctx: ctx, cancel: func() {}}, err }