Automattic\WooCommerce\Internal\BatchProcessing
BatchProcessingController::is_consistently_failing()
Determines whether a given processor is consistently failing based on how many recent consecutive failures it has had.
Метод класса: BatchProcessingController{}
Хуки из метода
Возвращает
true|false
. TRUE if processor is consistently failing. FALSE otherwise.
Использование
// private - только в коде основоного (родительского) класса $result = $this->is_consistently_failing( $batch_processor ): bool;
- $batch_processor(BatchProcessorInterface) (обязательный)
- The processor that we want to check.
Список изменений
С версии 9.1.0 | Введена. |
Код BatchProcessingController::is_consistently_failing() BatchProcessingController::is consistently failing WC 9.6.1
private function is_consistently_failing( BatchProcessorInterface $batch_processor ): bool { $process_details = $this->get_process_details( $batch_processor ); $max_attempts = absint( /** * Controls the failure threshold for batch processors. That is, the number of times we'll attempt to * process a batch that has resulted in a failure. Once above this threshold, the processor won't be * re-scheduled and will be removed from the queue. * * @since 9.1.0 * * @param int $failure_threshold Maximum number of times for the processor to try processing a given batch. * @param BatchProcessorInterface $batch_processor The processor instance. * @param array $process_details Array with batch processor state. */ apply_filters( 'wc_batch_processing_max_attempts', self::FAILING_PROCESS_MAX_ATTEMPTS_DEFAULT, $batch_processor, $process_details ) ); return absint( $process_details['recent_failures'] ?? 0 ) >= max( $max_attempts, 1 ); }