What's Changed
- Updated CODEOWNERS to use jira key by @bhardie in #117
- Add Chain ID for better control of background process lifecycle by @ianmjones in #124
Full Changelog: 1.3.1...1.4.0
Chain ID
A Chain ID has been introduced that is automatically generated for each unique chain of background processes.
The Chain ID is a UUIDv4.
The Chain ID is carried across from one dispatched background process to its successor via a simple URL param in order to be as compatible as possible.
To avoid any potential WAF rules that might take offence to a chain_id
param in the URL, the default chain_id
param name can be altered via a {identifier}_chain_id_arg_name
filter.
The Chain ID is exposed to interested parties in a number of ways to allow users of the library to monitor and control the lifecycle of background processes, e.g. to ensure that only one process chain is running.
There is now a {identifier}_pre_dispatch
filter that is fired before dispatch
which can be used to cancel a dispatch
before it happens by returning true
(for cancel). The 2nd param to the new filter is the chain_id
.
The existing {identifier}_paused/resumed/cancelled/completed
actions now include the chain_id
as a param.
Similarly, the {identifier}_process_locked
and {identifier}_process_unlocked
actions now include the chain_id
as a param.
Port-forwarded Improvements
Various other improvements have been port-forwarded from use in our plugins.
- A new
get_status
function that works around issues with the options cache exists and is used byis_paused
andis_cancelled
. - The
lock_process
function now takes an optional$reset_start_time
param that istrue
by default. This is useful when you wish to refresh the lock transient to keep it alive longer without changing the start time held in the record that may be significant to a calculation. - A public
should_continue
function has been added that wraps the checks of batch limits or status change requests that mean no further processing of thetask
should continue. - A public
get_identifier
function has been added to make it easier to create hooks in plugins that use the library and validate that the process is of interest.