Automattic\WooCommerce\Internal\ProductFeed\Integrations\POSCatalog
AsyncGenerator::schedule_generation_action
Schedules (and immediately dispatches) an async action to process a feed generation chunk.
Method of the class: AsyncGenerator{}
No Hooks.
Returns
null. Nothing (null).
Usage
// private - for code of main (parent) class only $result = $this->schedule_generation_action( $option_key ): void;
- $option_key(string) (required)
- The option key for the feed generation status.
AsyncGenerator::schedule_generation_action() AsyncGenerator::schedule generation action code WC 11.0.0
private function schedule_generation_action( string $option_key ): void {
// Deliberately not enqueued as "unique": Action Scheduler's uniqueness check matches on hook +
// group only (not args) and treats a running action as a blocker, so a unique enqueue of the next
// chunk would be rejected while the current chunk's action is still running. Per-job de-duplication
// is handled by as_unschedule_all_actions() in get_status() instead.
as_enqueue_async_action(
self::FEED_GENERATION_ACTION,
array( $option_key ),
'woo-product-feed',
false,
1
);
// Force an async request so the action runs immediately.
if ( class_exists( ActionScheduler_AsyncRequest_QueueRunner::class ) && class_exists( ActionScheduler_Store::class ) ) {
$store = ActionScheduler_Store::instance();
$async_request = new ActionScheduler_AsyncRequest_QueueRunner( $store );
$async_request->dispatch();
}
}