Automattic\WooCommerce\Internal\ProductFeed\Integrations\POSCatalog
AsyncGenerator::get_chunk_batch_count
Returns the number of batches to process per chunk, derived from the effective chunk size.
Method of the class: AsyncGenerator{}
Hooks from the method
Returns
Int. The number of batches per chunk (at least 1).
Usage
// private - for code of main (parent) class only $result = $this->get_chunk_batch_count( $option_key ): int;
- $option_key(string) (required)
- The option key for the feed generation status.
AsyncGenerator::get_chunk_batch_count() AsyncGenerator::get chunk batch count code WC 11.0.0
private function get_chunk_batch_count( string $option_key ): int {
/**
* Filters the number of products processed per chunk during feed generation.
*
* Each chunk runs in its own Action Scheduler action and then schedules the next, keeping every
* run short enough to finish within Action Scheduler's failure period and the host's request
* timeout. Defaults to the effective chunk size, which starts large and shrinks if a run gets stuck.
*
* @param int $chunk_size The number of products to process per chunk.
*
* @since 11.0.0
*/
$chunk_size = (int) apply_filters( 'woocommerce_product_feed_chunk_size', $this->get_effective_chunk_size( $option_key ) );
if ( $chunk_size < 1 ) {
$chunk_size = self::CHUNK_SIZE_STEPS[0];
}
return (int) max( 1, (int) ceil( $chunk_size / $this->get_batch_size() ) );
}