Automattic\WooCommerce\Internal\StockNotifications\AsyncTasks
CycleStateService::complete_cycle
Complete the cycle.
Method of the class: CycleStateService{}
No Hooks.
Returns
null. Nothing (null).
Usage
$CycleStateService = new CycleStateService(); $CycleStateService->complete_cycle( $product_id, $cycle_state ): void;
- $product_id(int|string) (required)
- The product ID.
- $cycle_state(array) (required)
- The cycle state.
CycleStateService::complete_cycle() CycleStateService::complete cycle code WC 10.3.6
public function complete_cycle( int $product_id, array $cycle_state ): void {
$cycle_state['duration'] = time() - $cycle_state['cycle_start_time'];
$this->logger->info(
sprintf( 'Completed cycle for product %d. Sent: %d, Skipped: %d, Failed: %d, Duration: %d seconds. Total notifications processed: %d', $product_id, $cycle_state['sent_count'], $cycle_state['skipped_count'], $cycle_state['failed_count'], $cycle_state['duration'], $cycle_state['total_count'] ),
array( 'source' => 'wc-customer-stock-notifications' )
);
$this->save_cycle_state( $product_id, array() );
}