Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions changelog.d/4483-job-lifecycle-hooks.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- Background jobs gained lifecycle hooks. `beforePerform(data)` and `afterPerform(data, result)` run with `perform()`, under its timeout, and a throw from either fails the attempt. `onSuccess(result)` runs once the job is recorded as completed, and `onFailure(error, attempt, isFinal)` after each failed attempt, with `isFinal = true` when the job won't be tried again (including when a crashed worker's last attempt is reaped). Both are best-effort: a throw is logged and never changes the job's outcome. `set(jobsOnFailure = "component.path.method")` adds an app-wide failure hook, called with one struct (`jobId`, `jobClass`, `queue`, `attempt`, `maxRetries`, `isFinal`, `error`) as its `event` argument; job data is never passed to it. `perform()`'s return value is now stored in a new `wheels_jobs.result` column (added automatically): simple values as-is, anything else as JSON, cut short at 4000 bytes with a `...[truncated]` marker. ([#4483](https://github.com/wheels-dev/wheels/issues/4483))
Loading
Loading