ActionScheduler_Abstract_QueueRunner::cancel_corrupted_actionprivateWC 1.0

Cancels the corrupted actions and performs the necessary cleanup to address identified side effects.

Method of the class: ActionScheduler_Abstract_QueueRunner{}

Returns

null. Nothing (null).

Usage

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

ActionScheduler_Abstract_QueueRunner::cancel_corrupted_action() code WC 11.0.1

private function cancel_corrupted_action( int $action_id ) {
	$this->store->cancel_action( $action_id );

	// Corrupted entries typically contain an excessive number of logs, which we intend to remove immediately.
	do_action( 'action_scheduler_canceled_corrupted_action', $action_id );

	// Add a comment to clarify the missing logs and explain the reason for the cancellation.
	ActionScheduler_Logger::instance()->log(
		$action_id,
		__( 'This action data appears to be corrupt. We are cancelling it to allow recurring actions to be re-created by extensions.', 'woocommerce' )
	);
}