ActionScheduler_QueueCleaner::reset_timeouts()publicWC 1.0

Unclaim pending actions that have not been run within a given time limit.

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->reset_timeouts( $time_limit );
$time_limit(int)
The number of seconds to allow a queue to run before unclaiming its pending actions.
По умолчанию: 300 (5 minutes)

Код ActionScheduler_QueueCleaner::reset_timeouts() WC 8.7.0

public function reset_timeouts( $time_limit = 300 ) {
	$timeout = apply_filters( 'action_scheduler_timeout_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_PENDING,
		'modified'         => $cutoff,
		'modified_compare' => '<=',
		'claimed'          => true,
		'per_page'         => $this->get_batch_size(),
		'orderby'          => 'none',
	) );

	foreach ( $actions_to_reset as $action_id ) {
		$this->store->unclaim_action( $action_id );
		do_action( 'action_scheduler_reset_action', $action_id );
	}
}