From 7077e9c556d9bfab069c29b76e86a5f7380fa497 Mon Sep 17 00:00:00 2001 From: Jack Danger Date: Fri, 9 Oct 2026 04:59:03 +0000 Subject: [PATCH 1/2] Document that EventKindJobCancelled fires only for worked jobs Client.JobCancel on a job that isn't running (available, scheduled, retryable) finalizes it in the database and emits no event: subscribers only see cancellations of jobs a client was working. Say so on the event kind, and point at the JobRow JobCancel returns. Signed-off-by: Jack Danger --- event.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/event.go b/event.go index 15565357c..e81bbdc29 100644 --- a/event.go +++ b/event.go @@ -11,7 +11,10 @@ import ( type EventKind string const ( - // EventKindJobCancelled occurs when a job is cancelled. + // EventKindJobCancelled occurs when a job being worked is cancelled: its + // worker returned JobCancel, or Client.JobCancel reached the running job + // and the worker then returned. A cancel issued for a job that isn't + // running emits nothing; observe it via the JobRow JobCancel returns. EventKindJobCancelled EventKind = "job_cancelled" // EventKindJobCompleted occurs when a job is completed. From 02fbd6c5969efea37a9f02be68f28e7e07eddcdd Mon Sep 17 00:00:00 2001 From: Brandur Date: Fri, 9 Oct 2026 17:36:00 -0500 Subject: [PATCH 2/2] Clarify cancelled job event documentation --- event.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/event.go b/event.go index e81bbdc29..8df590c01 100644 --- a/event.go +++ b/event.go @@ -11,10 +11,10 @@ import ( type EventKind string const ( - // EventKindJobCancelled occurs when a job being worked is cancelled: its - // worker returned JobCancel, or Client.JobCancel reached the running job - // and the worker then returned. A cancel issued for a job that isn't - // running emits nothing; observe it via the JobRow JobCancel returns. + // EventKindJobCancelled occurs when a client finishes working a job in the + // cancelled state. Cancelling a non-running job with Client.JobCancel or + // Client.JobCancelTx updates it directly without emitting this event; + // inspect the returned JobRow to observe that cancellation. EventKindJobCancelled EventKind = "job_cancelled" // EventKindJobCompleted occurs when a job is completed.