ActionScheduler_QueueCleaner::mark_failurespublicWC 1.0

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.

Метод класса: ActionScheduler_QueueCleaner{}

Возвращает

null. Ничего (null).

Использование

$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.
По умолчанию: 300 (5 minutes)

Код ActionScheduler_QueueCleaner::mark_failures() WC 9.9.4

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 );
	}
}