ActionScheduler_Abstract_QueueRunner::schedule_next_instance()protectedWC 1.0

Schedule the next instance of the action if necessary.

Method of the class: ActionScheduler_Abstract_QueueRunner{}

Return

null. Nothing (null).

Usage

// protected - for code of main (parent) or child class
$result = $this->schedule_next_instance( $action, $action_id );
$action(ActionScheduler_Action) (required)
-
$action_id(int) (required)
-

ActionScheduler_Abstract_QueueRunner::schedule_next_instance() code WC 9.3.1

protected function schedule_next_instance( ActionScheduler_Action $action, $action_id ) {
	// If a recurring action has been consistently failing, we may wish to stop rescheduling it.
	if (
		ActionScheduler_Store::STATUS_FAILED === $this->store->get_status( $action_id )
		&& $this->recurring_action_is_consistently_failing( $action, $action_id )
	) {
		ActionScheduler_Logger::instance()->log(
			$action_id,
			__( 'This action appears to be consistently failing. A new instance will not be scheduled.', 'woocommerce' )
		);

		return;
	}

	try {
		ActionScheduler::factory()->repeat( $action );
	} catch ( Exception $e ) {
		do_action( 'action_scheduler_failed_to_schedule_next_instance', $action_id, $e, $action );
	}
}