WC_Tracks_Client::send_batched_pixelspublic staticWC 10.5.0

Send all queued pixels using batched non-blocking requests. This runs on the shutdown hook to batch all requests together.

Uses Requests library's request_multiple() for true parallel batching via curl_multi.

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

Хуков нет.

Возвращает

null. Ничего (null).

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

$result = WC_Tracks_Client::send_batched_pixels(): void;

Список изменений

С версии 10.5.0 Введена.

Код WC_Tracks_Client::send_batched_pixels() WC 10.8.1

public static function send_batched_pixels(): void {
	if ( empty( self::$pixel_batch_queue ) ) {
		return;
	}

	// Add request timestamp and nocache to all pixels.
	$pixels_to_send = array();
	foreach ( self::$pixel_batch_queue as $pixel ) {
		$pixels_to_send[] = self::add_request_timestamp_and_nocache( $pixel );
	}

	// Send with Requests library for true parallel batching.
	self::send_with_requests_multiple( $pixels_to_send );

	// Clear the queue.
	self::$pixel_batch_queue = array();
}