Automattic\WooCommerce\Internal\ProductFeed\Integrations\POSCatalog

AsyncGenerator::update_progress │ private │ WC 1.0

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

Метод класса: AsyncGenerator{}

Хуков нет.

Возвращает

array. The updated status.

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

// private - только в коде основоного (родительского) класса
$result = $this->update_progress( $status, $processed, $total ): array;
$status(массив) (обязательный)
The current feed generation status.
$processed(int) (обязательный)
The cumulative number of products processed so far.
$total(int) (обязательный)
The total number of products to process.

Код AsyncGenerator::update_progress() WC 11.2.2

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;
}