$cleaner
$cleaner : \ActionScheduler_QueueCleaner
ActionScheduler_QueueCleaner instance.
WP CLI Queue runner.
This class can only be called from within a WP CLI instance.
$cleaner : \ActionScheduler_QueueCleaner
ActionScheduler_QueueCleaner instance.
$monitor : \ActionScheduler_FatalErrorMonitor
ActionScheduler_FatalErrorMonitor instance.
$store : \ActionScheduler_Store
ActionScheduler_Store instance.
$actions : array
Claimed actions.
$claim : \ActionScheduler_ActionClaim
ActionScheduler_ActionClaim 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_WPCLI_QueueRunner constructor.
\ActionScheduler_Store|null | $store | Store object. |
\ActionScheduler_FatalErrorMonitor|null | $monitor | Monitor object. |
\ActionScheduler_QueueCleaner|null | $cleaner | Cleaner object. |
When this is not run within WP CLI.
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.
setup(int $batch_size, array $hooks = array(), string $group = '', bool $force = false) : int
Set up the Queue before processing.
int | $batch_size | The batch size to process. |
array | $hooks | The hooks being used to filter the actions claimed in this batch. |
string | $group | The group of actions to claim with this batch. |
bool | $force | Whether to force running even with too many concurrent processes. |
When there are too many concurrent batches.
The number of actions that will be run.
after_execute(int $action_id, null|\ActionScheduler_Action $action = null) : mixed
Handle WP CLI message when the action has completed.
int | $action_id | ActionID. |
null|\ActionScheduler_Action | $action | The instance of the action. Default to null for backward compatibility. |
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. |
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 |
None found |
stop_the_insanity(int $sleep_time) : mixed
Sleep and help avoid hitting memory limit
int | $sleep_time | Amount of seconds to sleep. |
None found |
maybe_stop_the_insanity() : mixed
Maybe trigger the stop_the_insanity() method to free up memory.
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 |