Automattic\WooCommerce\Internal\BatchProcessing

BatchProcessingController::process_next_batch_for_single_processor_core()privateWC 1.0

Process a batch for a single processor, updating state and logging any error.

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

Хуков нет.

Возвращает

null|\Exception. Exception if error occurred, null otherwise.

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

// private - только в коде основоного (родительского) класса
$result = $this->process_next_batch_for_single_processor_core( $batch_processor ): ?\Exception;
$batch_processor(BatchProcessorInterface) (обязательный)
Batch processor instance.

Код BatchProcessingController::process_next_batch_for_single_processor_core() WC 6.9.4

private function process_next_batch_for_single_processor_core( BatchProcessorInterface $batch_processor ): ?\Exception {
	$details    = $this->get_process_details( $batch_processor );
	$time_start = microtime( true );
	$batch      = $batch_processor->get_next_batch_to_process( $details['current_batch_size'] );
	if ( empty( $batch ) ) {
		return null;
	}
	try {
		$batch_processor->process_batch( $batch );
		$time_taken = microtime( true ) - $time_start;
		$this->update_processor_state( $batch_processor, $time_taken );
	} catch ( \Exception $exception ) {
		$time_taken = microtime( true ) - $time_start;
		$this->log_error( $exception, $batch_processor, $batch );
		$this->update_processor_state( $batch_processor, $time_taken, $exception );
		return $exception;
	}
	return null;
}