aboutsummaryrefslogtreecommitdiff
path: root/internal/lock
diff options
context:
space:
mode:
Diffstat (limited to 'internal/lock')
-rw-r--r--internal/lock/lock.go9
-rw-r--r--internal/lock/lock_test.go12
2 files changed, 10 insertions, 11 deletions
diff --git a/internal/lock/lock.go b/internal/lock/lock.go
index 2b98227..76a2b71 100644
--- a/internal/lock/lock.go
+++ b/internal/lock/lock.go
@@ -48,11 +48,10 @@ type Lock struct {
// already held, so a cron job never piles up behind a stuck run. When wait
// is true, Acquire polls every 100ms, with no fixed timeout - but it does
// not poll forever regardless of ctx: a cancelled or expired ctx makes a
-// waiting Acquire return ctx.Err() promptly instead of ignoring it (fix
-// round 2026-09-12/item 3 - a run blocked waiting for a held lock must
-// still notice Ctrl-C). ctx is not consulted at all when wait is false or
-// the lock is free on the first try, so -y's non-waiting callers are
-// unaffected.
+// waiting Acquire return ctx.Err() promptly instead of ignoring it - a run
+// blocked waiting for a held lock must still notice Ctrl-C. ctx is not
+// consulted at all when wait is false or the lock is free on the first
+// try, so -y's non-waiting callers are unaffected.
//
// A lock naming a pid that is not running is stale — the machine may have
// lost power mid-run. Acquire removes a stale lock and retries the O_EXCL
diff --git a/internal/lock/lock_test.go b/internal/lock/lock_test.go
index 53ce5ca..04023aa 100644
--- a/internal/lock/lock_test.go
+++ b/internal/lock/lock_test.go
@@ -69,12 +69,12 @@ func TestAcquireWaitsUntilReleased(t *testing.T) {
}
}
-// TestAcquireRespectsContextCancellation is fix round 2026-09-12/item 3: a
-// waiting Acquire must not ignore an interrupt - a cancelled ctx must return
-// promptly with ctx.Err(), not poll forever. The unfixed code HANGS rather
-// than fails here, so the wait for Acquire's result is itself bounded with
-// its own hard timeout: a regression must fail this test, not hang the
-// whole suite.
+// TestAcquireRespectsContextCancellation: a waiting Acquire must not
+// ignore an interrupt - a cancelled ctx must return promptly with
+// ctx.Err(), not poll forever. A regression here would HANG rather than
+// fail, so the wait for Acquire's result is itself bounded with its own
+// hard timeout: a regression must fail this test, not hang the whole
+// suite.
func TestAcquireRespectsContextCancellation(t *testing.T) {
path := filepath.Join(t.TempDir(), "dl.lock")
held, err := Acquire(context.Background(), path, false)