ActionScheduler_Abstract_QueueRunner::fetch_complete_actionprivateWC 1.0

Fetches the action instance. On failure returns null instead of ActionScheduler_NullAction.

Method of the class: ActionScheduler_Abstract_QueueRunner{}

No Hooks.

Returns

ActionScheduler_Action|null.

Usage

// private - for code of main (parent) class only
$result = $this->fetch_complete_action( $action_id );
$action_id(int) (required)
Action ID.

ActionScheduler_Abstract_QueueRunner::fetch_complete_action() code WC 11.0.1

private function fetch_complete_action( int $action_id ) {
	// Handle corrupted entries and potential DB read failures (corrupted arguments or schedule data; a known trigger is incomplete A-S migration).
	$attempts_to_populate = 0;
	do {
		$action  = $this->store->fetch_action( $action_id );
		$failure = $action instanceof ActionScheduler_NullAction;
		// Sleep 0.01 second before retrying.
		usleep( 10000 * (int) $failure );
	} while ( $failure && ++$attempts_to_populate < 2 );

	return $action instanceof ActionScheduler_NullAction ? null : $action;
}