Automattic\WooCommerce\Internal\PushNotifications\Services

NotificationProcessor::cancel_safety_netprivateWC 10.9.0

Cancels the pending safety net ActionScheduler job for a notification.

Called after the processor handles the notification (whether success or failure with retry scheduled) so the safety net doesn't fire redundantly.

Method of the class: NotificationProcessor{}

No Hooks.

Returns

null. Nothing (null).

Usage

// private - for code of main (parent) class only
$result = $this->cancel_safety_net( $notification ): void;
$notification(Notification) (required)
The notification whose safety net to cancel.

Changelog

Since 10.9.0 Introduced.

NotificationProcessor::cancel_safety_net() code WC 10.9.1

private function cancel_safety_net( Notification $notification ): void {
	// Must match the shape PendingNotificationStore::schedule_safety_net() used;
	// both derive the args from Notification::get_safety_net_args() so the
	// exact-equality match Action Scheduler performs succeeds.
	as_unschedule_all_actions(
		self::SAFETY_NET_HOOK,
		$notification->get_safety_net_args(),
		self::ACTION_SCHEDULER_GROUP
	);
}