BatchProcessingController::update_processor_state()privateWC 1.0

Update the state for a processor after a batch has completed processing.

Method of the class: BatchProcessingController{}

No Hooks.


null. Nothing (null).


// private - for code of main (parent) class only
$result = $this->update_processor_state( $batch_processor, $time_taken, $last_error ): void;
$batch_processor(BatchProcessorInterface) (required)
Batch processor instance.
$time_taken(float) (required)
Time take by the batch to complete processing.
Exception object in processing the batch, if there was one.
Default: null

BatchProcessingController::update_processor_state() code WC 8.7.0

private function update_processor_state( BatchProcessorInterface $batch_processor, float $time_taken, \Exception $last_error = null ): void {
	$current_status                      = $this->get_process_details( $batch_processor );
	$current_status['total_time_spent'] += $time_taken;
	$current_status['last_error']        = null !== $last_error ? $last_error->getMessage() : null;
	update_option( $this->get_processor_state_option_name( $batch_processor ), $current_status, false );