From 23f868079ee6b6b42dbeb2b658bdef6ba5fa0b54 Mon Sep 17 00:00:00 2001 From: Matthew Holt Date: Tue, 5 Mar 2024 14:41:45 -0700 Subject: [PATCH] Use context.WIthoutCancel when releasing locks Fulfills a TODO. Makes it so locks can be released when shutting down/reloading. --- storage.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/storage.go b/storage.go index 3d88f2e..faf7315 100644 --- a/storage.go +++ b/storage.go @@ -289,7 +289,7 @@ func acquireLock(ctx context.Context, storage Storage, lockKey string) error { } func releaseLock(ctx context.Context, storage Storage, lockKey string) error { - err := storage.Unlock(context.TODO(), lockKey) // TODO: in Go 1.21, use WithoutCancel (see #247) + err := storage.Unlock(context.WithoutCancel(ctx), lockKey) if err == nil { locksMu.Lock() delete(locks, lockKey)