From c09d5d783cc478f73e7230cfeda101d00d307557 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Wed, 1 Apr 2026 09:00:59 -1000 Subject: [PATCH] [api] Fix immediate benchmark to set batch_delay=0 should_send_immediately_ requires both should_try_send_immediately flag AND batch_delay==0. Without setting batch_delay to 0, all sends were falling back to the batch path. --- tests/benchmarks/components/api/bench_send_sensor_state.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/benchmarks/components/api/bench_send_sensor_state.cpp b/tests/benchmarks/components/api/bench_send_sensor_state.cpp index 815d612049..815081374a 100644 --- a/tests/benchmarks/components/api/bench_send_sensor_state.cpp +++ b/tests/benchmarks/components/api/bench_send_sensor_state.cpp @@ -46,6 +46,9 @@ class TestSensor : public sensor::Sensor { static void SendSensorState_Immediate(benchmark::State &state) { auto [conn, read_fd] = create_api_connection(); bench_enable_immediate_send(conn.get()); + // batch_delay must be 0 for should_send_immediately_ to return true + uint16_t saved_delay = global_api_server->get_batch_delay(); + global_api_server->set_batch_delay(0); TestSensor sensor; sensor.configure("test_sensor"); @@ -60,6 +63,7 @@ static void SendSensorState_Immediate(benchmark::State &state) { } state.SetItemsProcessed(state.iterations() * kInnerIterations); + global_api_server->set_batch_delay(saved_delay); ::close(read_fd); } BENCHMARK(SendSensorState_Immediate);