Use context.WIthoutCancel when releasing locks

Fulfills a TODO. Makes it so locks can be released when shutting down/reloading.
This commit is contained in:
Matthew Holt 2024-03-05 14:41:45 -07:00
parent 8613f4a444
commit 23f868079e
No known key found for this signature in database
GPG Key ID: 2A349DD577D586A5

View File

@ -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)