Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,15 @@ type Worker[T JobArgs] interface {
// marked completed.
//
// It is important for any worker to respect context cancellation to enable
// the client to respond to shutdown requests; there is no way to cancel a
// running job that does not respect context cancellation, other than
// terminating the process.
// the client to respond to shutdown requests. In particular, workers that
// wait on channels, timers, or network operations should prefer a `select`
// that also watches `ctx.Done()`. There is no way to cancel a running job
// that does not respect context cancellation, other than terminating the
// process.
//
// A worker that ignores cancellation may continue running even after the
// client has timed out the job or the job rescuer has moved it out of
// running.
Work(ctx context.Context, job *Job[T]) error
}

Expand Down
Loading