ActionScheduler_QueueCleaner::mark_failures()
Mark actions that have been running for more than a given time limit as failed, based on the assumption some uncatchable and unloggable fatal error occurred during processing.
When called by ActionScheduler_Abstract_QueueRunner::run_cleanup(), the time limit passed as a parameter is 10x the time limit used for queue processing.
Method of the class: ActionScheduler_QueueCleaner{}
Hooks from the method
Return
null
. Nothing (null).
Usage
$ActionScheduler_QueueCleaner = new ActionScheduler_QueueCleaner(); $ActionScheduler_QueueCleaner->mark_failures( $time_limit );
- $time_limit(int)
- The number of seconds to allow an action to run before it is considered to have failed.
Default: 300 (5 minutes)
ActionScheduler_QueueCleaner::mark_failures() ActionScheduler QueueCleaner::mark failures code WC 9.3.3
public function mark_failures( $time_limit = 300 ) { $timeout = apply_filters( 'action_scheduler_failure_period', $time_limit ); if ( $timeout < 0 ) { return; } $cutoff = as_get_datetime_object($timeout.' seconds ago'); $actions_to_reset = $this->store->query_actions( array( 'status' => ActionScheduler_Store::STATUS_RUNNING, 'modified' => $cutoff, 'modified_compare' => '<=', 'per_page' => $this->get_batch_size(), 'orderby' => 'none', ) ); foreach ( $actions_to_reset as $action_id ) { $this->store->mark_failure( $action_id ); do_action( 'action_scheduler_failed_action', $action_id, $timeout ); } }