From efe3ffe1da67ea5cff06732b436fbd30db94d2fc Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Fri, 6 Jun 2025 19:28:36 +0100 Subject: [PATCH] remove unused timestamp --- esphome/components/api/api_connection.cpp | 6 +++--- esphome/components/api/api_connection.h | 5 ++--- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/esphome/components/api/api_connection.cpp b/esphome/components/api/api_connection.cpp index 4ea56f4810..da5554f486 100644 --- a/esphome/components/api/api_connection.cpp +++ b/esphome/components/api/api_connection.cpp @@ -1707,17 +1707,17 @@ void APIConnection::on_fatal_error() { void APIConnection::DeferredBatch::add_item(EntityBase *entity, MessageCreator creator, uint16_t message_type) { // Check if we already have a message of this type for this entity // This provides deduplication per entity/message_type combination + // O(n) but optimized for RAM and not performance. for (auto &item : items) { if (item.entity == entity && item.message_type == message_type) { - // Update the existing item with the new creator and timestamp + // Update the existing item with the new creator item.creator = std::move(creator); - item.timestamp = App.get_loop_component_start_time(); return; } } // No existing item found, add new one - items.emplace_back(entity, std::move(creator), App.get_loop_component_start_time(), message_type); + items.emplace_back(entity, std::move(creator), message_type); } bool APIConnection::schedule_batch_() { diff --git a/esphome/components/api/api_connection.h b/esphome/components/api/api_connection.h index c39c8fa7e2..ca21d591af 100644 --- a/esphome/components/api/api_connection.h +++ b/esphome/components/api/api_connection.h @@ -488,14 +488,13 @@ class APIConnection : public APIServerConnection { struct BatchItem { EntityBase *entity; // Entity pointer MessageCreator creator; // Function that creates the message when needed - uint32_t timestamp; // When this update was queued uint16_t message_type; // Message type for overhead calculation // Constructor for creating BatchItem BatchItem(EntityBase *entity, std::function creator, - uint32_t timestamp, uint16_t message_type) - : entity(entity), creator(std::move(creator)), timestamp(timestamp), message_type(message_type) {} + uint16_t message_type) + : entity(entity), creator(std::move(creator)), message_type(message_type) {} }; std::vector items;