Automattic\WooCommerce\Internal\BatchProcessing

BatchProcessingController::process_next_batch_for_single_processor()privateWC 1.0

Process a batch for a single processor, and handle any required rescheduling or state cleanup.

{} Это метод класса: BatchProcessingController{}

Хуков нет.

Возвращает

null. Ничего.

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

// private - только в коде основоного (родительского) класса
$result = $this->process_next_batch_for_single_processor( $processor_class_name ): void;
$processor_class_name(строка) (обязательный)
Fully qualified class name of the processor.

Код BatchProcessingController::process_next_batch_for_single_processor() WC 6.9.4

private function process_next_batch_for_single_processor( string $processor_class_name ): void {
	if ( ! $this->is_enqueued( $processor_class_name ) ) {
		return;
	}

	$batch_processor      = $this->get_processor_instance( $processor_class_name );
	$pending_count_before = $batch_processor->get_total_pending_count();
	$error                = $this->process_next_batch_for_single_processor_core( $batch_processor );
	$pending_count_after  = $batch_processor->get_total_pending_count();
	if ( ( $error instanceof \Exception ) && $pending_count_before === $pending_count_after ) {
		// The batch processing failed and no items were processed:
		// reschedule the processing with a delay, and also throw the error
		// so Action Scheduler will ignore the rescheduling if this happens repeatedly.
		$this->schedule_batch_processing( $processor_class_name, true );
		throw $error;
	}
	if ( $pending_count_after > 0 ) {
		$this->schedule_batch_processing( $processor_class_name );
	} else {
		$this->dequeue_processor( $processor_class_name );
	}
}