WC_Webhook::failed_delivery()privateWC 2.2.0

Track consecutive delivery failures and automatically disable the webhook. if more than 5 consecutive failures occur. A failure is defined as a. non-2xx response.

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

Возвращает

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

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

// private - только в коде основоного (родительского) класса
$result = $this->failed_delivery();

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

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

Код WC_Webhook::failed_delivery() WC 8.7.0

private function failed_delivery() {
	$failures = $this->get_failure_count();

	if ( $failures > apply_filters( 'woocommerce_max_webhook_delivery_failures', 5 ) ) {
		$this->set_status( 'disabled' );

		do_action( 'woocommerce_webhook_disabled_due_delivery_failures', $this->get_id() );
	} else {
		$this->set_failure_count( ++$failures );
	}

	$this->save();
}