Automattic\WooCommerce\Internal\ProductFeed\Integrations\POSCatalog
AsyncGenerator::reduce_chunk_size_if_stuck
Steps the chunk size down when an invalidated status was a stuck in-progress job.
A stuck job was most likely killed because its chunk was too large for the host, so a smaller chunk makes the restart more likely to fit. A genuine failure (state = failed) is a real error rather than a size symptom and is intentionally excluded. Both recovery paths — an ordinary poll ({@see get_status()}) and an explicit rebuild ({@see force_regeneration()}) — call this, so a stuck job adapts the same way however it is recovered.
Method of the class: AsyncGenerator{}
No Hooks.
Returns
null. Nothing (null).
Usage
// private - for code of main (parent) class only $result = $this->reduce_chunk_size_if_stuck( $status, $option_key ): void;
- $status(array) (required)
- The invalidated status being discarded.
- $option_key(string) (required)
- The option key for the feed generation status.
AsyncGenerator::reduce_chunk_size_if_stuck() AsyncGenerator::reduce chunk size if stuck code WC 11.0.0
private function reduce_chunk_size_if_stuck( array $status, string $option_key ): void {
if ( self::STATE_IN_PROGRESS === ( $status['state'] ?? '' ) ) {
$this->reduce_chunk_size( $option_key );
}
}