ActionScheduler_Abstract_QueueRunner::time_likely_to_be_exceeded()protectedWC 1.0

Check if the host's max execution time is (likely) to be exceeded if processing more actions.

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

Возвращает

true|false.

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->time_likely_to_be_exceeded( $processed_actions );
$processed_actions(int) (обязательный)
The number of actions processed so far - used to determine the likelihood of exceeding the time limit if processing another action

Код ActionScheduler_Abstract_QueueRunner::time_likely_to_be_exceeded() WC 8.7.0

protected function time_likely_to_be_exceeded( $processed_actions ) {
	$execution_time     = $this->get_execution_time();
	$max_execution_time = $this->get_time_limit();

	// Safety against division by zero errors.
	if ( 0 === $processed_actions ) {
		return $execution_time >= $max_execution_time;
	}

	$time_per_action       = $execution_time / $processed_actions;
	$estimated_time        = $execution_time + ( $time_per_action * 3 );
	$likely_to_be_exceeded = $estimated_time > $max_execution_time;

	return apply_filters( 'action_scheduler_maximum_execution_time_likely_to_be_exceeded', $likely_to_be_exceeded, $this, $processed_actions, $execution_time, $max_execution_time );
}