Automattic\WooCommerce\Internal\PushNotifications\Services

PendingNotificationStore::schedule_safety_net │ private │ WC 10.7.0

Schedules an ActionScheduler safety net job for the notification.

If the shutdown hook never fires (OOM, SIGKILL, etc.), this job guarantees the notification is still processed.

Метод класса: PendingNotificationStore{}

Хуков нет.

Возвращает

void. Ничего (null).

Использование

// private - только в коде основоного (родительского) класса
$result = $this->schedule_safety_net( $notification ): void;
$notification(Notification) (обязательный)
The notification to schedule.

Список изменений

С версии 10.7.0 Введена.

Код PendingNotificationStore::schedule_safety_net() WC 11.2.2

private function schedule_safety_net( Notification $notification ): void {
	// Canonical, identity-keyed args shared with NotificationProcessor::cancel_safety_net().
	// Action Scheduler matches stored args by exact equality, so both sides must derive
	// them from the same place; see Notification::get_safety_net_args().
	$args = $notification->get_safety_net_args();

	if ( as_has_scheduled_action( NotificationProcessor::SAFETY_NET_HOOK, $args, NotificationProcessor::ACTION_SCHEDULER_GROUP ) ) {
		return;
	}

	as_schedule_single_action(
		time() + NotificationProcessor::SAFETY_NET_DELAY,
		NotificationProcessor::SAFETY_NET_HOOK,
		$args,
		NotificationProcessor::ACTION_SCHEDULER_GROUP,
		true
	);
}