Skip to content

Commit

Permalink
Use context.WIthoutCancel when releasing locks
Browse files Browse the repository at this point in the history
Fulfills a TODO. Makes it so locks can be released when shutting down/reloading.
  • Loading branch information
mholt committed Mar 5, 2024
1 parent 8613f4a commit 23f8680
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Check failure on line 292 in storage.go

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, 1.19)

undefined: context.WithoutCancel

Check failure on line 292 in storage.go

View workflow job for this annotation

GitHub Actions / test (ubuntu-latest, 1.20)

undefined: context.WithoutCancel
if err == nil {
locksMu.Lock()
delete(locks, lockKey)
Expand Down

0 comments on commit 23f8680

Please sign in to comment.