$cleaner
$cleaner : \ActionScheduler_QueueCleaner
ActionScheduler_QueueCleaner instance.
Abstract class with common Queue Cleaner functionality.
$cleaner : \ActionScheduler_QueueCleaner
ActionScheduler_QueueCleaner instance.
$monitor : \ActionScheduler_FatalErrorMonitor
ActionScheduler_FatalErrorMonitor instance.
$store : \ActionScheduler_Store
ActionScheduler_Store instance.
$created_time : int
The created time.
Represents when the queue runner was constructed and used when calculating how long a PHP request has been running. For this reason it should be as close as possible to the PHP request start time.
__construct(\ActionScheduler_Store|null $store = null, \ActionScheduler_FatalErrorMonitor|null $monitor = null, \ActionScheduler_QueueCleaner|null $cleaner = null) : mixed
ActionScheduler_Abstract_QueueRunner constructor.
\ActionScheduler_Store|null | $store | Store object. |
\ActionScheduler_FatalErrorMonitor|null | $monitor | Monitor object. |
\ActionScheduler_QueueCleaner|null | $cleaner | Cleaner object. |
process_action(int $action_id, string $context = '') : mixed
Process an individual action.
int | $action_id | The action ID to process. |
string | $context | Optional identifier for the context in which this action is being processed, e.g. 'WP CLI' or 'WP Cron' Generally, this should be capitalised and not localised as it's a proper noun. |
When error running action.
run(string $context = '') : int
Process actions in the queue.
string | $context | Optional identifier for the context in which this action is being processed, e.g. 'WP CLI' or 'WP Cron' Generally, this should be capitalised and not localised as it's a proper noun. |
The number of actions processed.
schedule_next_instance(\ActionScheduler_Action $action, int $action_id) : mixed
Schedule the next instance of the action if necessary.
\ActionScheduler_Action | $action | Action. |
int | $action_id | Action ID. |
None found |
None found |
get_time_limit() : int
Get the maximum number of seconds a batch can run for.
The number of seconds.
None found |
get_execution_time() : int
Get the number of seconds the process has been running.
The number of seconds.
None found |
time_likely_to_be_exceeded(int $processed_actions) : bool
Check if the host's max execution time is (likely) to be exceeded if processing more actions.
int | $processed_actions | The number of actions processed so far - used to determine the likelihood of exceeding the time limit if processing another action. |
None found |
get_memory_limit() : int
Get memory limit
Based on WP_Background_Process::get_memory_limit()
None found |
memory_exceeded() : bool
Memory exceeded
Ensures the batch process never exceeds 90% of the maximum WordPress memory.
Based on WP_Background_Process::memory_exceeded()
None found |
batch_limits_exceeded(int $processed_actions) : bool
See if the batch limits have been exceeded, which is when memory usage is almost at the maximum limit, or the time to process more actions will exceed the max time limit.
Based on WC_Background_Process::batch_limits_exceeded()
int | $processed_actions | The number of actions processed so far - used to determine the likelihood of exceeding the time limit if processing another action. |
None found |
handle_action_error(int $action_id, \Exception $e, string $context, bool $valid_action) : void
Marks actions as either having failed execution or failed validation, as appropriate.
int | $action_id | Action ID. |
\Exception | $e | Exception instance. |
string | $context | Execution context. |
bool | $valid_action | If the action is valid. |
None found |
recurring_action_is_consistently_failing(\ActionScheduler_Action $action, int $action_id) : bool
Determine if the specified recurring action has been consistently failing.
\ActionScheduler_Action | $action | The recurring action to be rescheduled. |
int | $action_id | The ID of the recurring action. |
None found |