Automattic\WooCommerce\Internal\ProductFeed\Integrations\POSCatalog

AsyncGenerator::update_progressprivateWC 1.0

Updates the cumulative progress fields on the status and refreshes the heartbeat.

Method of the class: AsyncGenerator{}

No Hooks.

Returns

Array. The updated status.

Usage

// private - for code of main (parent) class only
$result = $this->update_progress( $status, $processed, $total ): array;
$status(array) (required)
The current feed generation status.
$processed(int) (required)
The cumulative number of products processed so far.
$total(int) (required)
The total number of products to process.

AsyncGenerator::update_progress() code WC 11.0.0

private function update_progress( array $status, int $processed, int $total ): array {
	$status['processed']  = $processed;
	$status['total']      = $total;
	$status['progress']   = $total > 0 ? round( ( $processed / $total ) * 100, 2 ) : 0;
	$status['updated_at'] = time();
	return $status;
}