container->get( \Gravity_Forms\Gravity_Forms\Async\GF_Background_Process_Service_Provider::TELEMETRY ); $full_telemetry_data = GF_Telemetry_Data::get_data(); $snapshot = $full_telemetry_data['snapshot']; // Enqueue the snapshot first, alone, to be sent to its own endpoint. $processor->push_to_queue( $snapshot ); $processor->save()->dispatch(); $full_telemetry_data = array_chunk( $full_telemetry_data['events'], self::BATCH_SIZE, true ); foreach ( $full_telemetry_data as $batch ) { $processor->push_to_queue( $batch ); $processor->save()->dispatch(); } // Clear saved telemetry data except the snapshot. update_option( 'gf_telemetry_data', array( 'snapshot' => $snapshot, 'events' => array(), ), false ); } }