ActionScheduler_Abstract_QueueRunner
extends ActionScheduler_Abstract_QueueRunner_Deprecated
in package
Abstract class with common Queue Cleaner functionality.
Table of Contents
- $cleaner : ActionScheduler_QueueCleaner
- $monitor : ActionScheduler_FatalErrorMonitor
- $store : ActionScheduler_Store
- $created_time : int
- The created time.
- __construct() : mixed
- ActionScheduler_Abstract_QueueRunner constructor.
- get_allowed_concurrent_batches() : int
- Get the number of concurrent batches a runner allows.
- process_action() : mixed
- Process an individual action.
- run() : int
- Process actions in the queue.
- batch_limits_exceeded() : 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.
- get_execution_time() : int
- Get the number of seconds the process has been running.
- get_maximum_execution_time() : int
- Get the maximum number of seconds a batch can run for.
- get_memory_limit() : int
- Get memory limit
- get_time_limit() : int
- Get the maximum number of seconds a batch can run for.
- memory_exceeded() : bool
- Memory exceeded
- run_cleanup() : mixed
- Run the queue cleaner.
- schedule_next_instance() : mixed
- Schedule the next instance of the action if necessary.
- time_likely_to_be_exceeded() : bool
- Check if the host's max execution time is (likely) to be exceeded if processing more actions.
Properties
$cleaner
protected
ActionScheduler_QueueCleaner
$cleaner
$monitor
protected
ActionScheduler_FatalErrorMonitor
$monitor
$store
protected
ActionScheduler_Store
$store
$created_time
The created time.
private
int
$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.
Methods
__construct()
ActionScheduler_Abstract_QueueRunner constructor.
public
__construct([ActionScheduler_Store $store = null ][, ActionScheduler_FatalErrorMonitor $monitor = null ][, ActionScheduler_QueueCleaner $cleaner = null ]) : mixed
Parameters
- $store : ActionScheduler_Store = null
- $monitor : ActionScheduler_FatalErrorMonitor = null
- $cleaner : ActionScheduler_QueueCleaner = null
Return values
mixed —get_allowed_concurrent_batches()
Get the number of concurrent batches a runner allows.
public
get_allowed_concurrent_batches() : int
Return values
int —process_action()
Process an individual action.
public
process_action(int $action_id) : mixed
Parameters
- $action_id : int
-
The action ID to process.
Return values
mixed —run()
Process actions in the queue.
public
abstract run() : int
Tags
Return values
int —The number of actions processed.
batch_limits_exceeded()
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.
protected
batch_limits_exceeded(int $processed_actions) : bool
Based on WC_Background_Process::batch_limits_exceeded()
Parameters
- $processed_actions : int
-
The number of actions processed so far - used to determine the likelihood of exceeding the time limit if processing another action
Return values
bool —get_execution_time()
Get the number of seconds the process has been running.
protected
get_execution_time() : int
Return values
int —The number of seconds.
get_maximum_execution_time()
Get the maximum number of seconds a batch can run for.
protected
get_maximum_execution_time() : int
Tags
Return values
int —The number of seconds.
get_memory_limit()
Get memory limit
protected
get_memory_limit() : int
Based on WP_Background_Process::get_memory_limit()
Return values
int —get_time_limit()
Get the maximum number of seconds a batch can run for.
protected
get_time_limit() : int
Return values
int —The number of seconds.
memory_exceeded()
Memory exceeded
protected
memory_exceeded() : bool
Ensures the batch process never exceeds 90% of the maximum WordPress memory.
Based on WP_Background_Process::memory_exceeded()
Return values
bool —run_cleanup()
Run the queue cleaner.
protected
run_cleanup() : mixed
Tags
Return values
mixed —schedule_next_instance()
Schedule the next instance of the action if necessary.
protected
schedule_next_instance(ActionScheduler_Action $action) : mixed
Parameters
- $action : ActionScheduler_Action
Return values
mixed —time_likely_to_be_exceeded()
Check if the host's max execution time is (likely) to be exceeded if processing more actions.
protected
time_likely_to_be_exceeded(int $processed_actions) : bool
Parameters
- $processed_actions : int
-
The number of actions processed so far - used to determine the likelihood of exceeding the time limit if processing another action