ActionScheduler_Abstract_QueueRunner::time_likely_to_be_exceeded()
Check if the host's max execution time is (likely) to be exceeded if processing more actions.
Method of the class: ActionScheduler_Abstract_QueueRunner{}
Hooks from the method
Return
true|false
.
Usage
// protected - for code of main (parent) or child class $result = $this->time_likely_to_be_exceeded( $processed_actions );
- $processed_actions(int) (required)
- 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() ActionScheduler Abstract QueueRunner::time likely to be exceeded code WC 9.3.3
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 ); }