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.
Method of the class: BatchProcessingController{}
Hooks from the method
Return
true|false
. TRUE if processor is consistently failing. FALSE otherwise.
Usage
// private - for code of main (parent) class only $result = $this->is_consistently_failing( $batch_processor ): bool;
- $batch_processor(BatchProcessorInterface) (required)
- The processor that we want to check.
Changelog
Since 9.1.0 | Introduced. |
BatchProcessingController::is_consistently_failing() BatchProcessingController::is consistently failing code WC 9.3.3
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 ); }