From 60dcb64da11fcb01639c5361a86652a4d76ddbf0 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Thu, 5 Jun 2025 17:39:10 +0100 Subject: [PATCH] batch --- esphome/components/api/api_connection.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/esphome/components/api/api_connection.cpp b/esphome/components/api/api_connection.cpp index 5c10ee29ce..79f7c79e33 100644 --- a/esphome/components/api/api_connection.cpp +++ b/esphome/components/api/api_connection.cpp @@ -1816,16 +1816,16 @@ void APIConnection::process_batch_() { } } - // Remove processed updates from the batch - if (processed_count < this->deferred_state_batch_.updates.size()) { - // Some updates weren't processed, keep them for next batch - this->deferred_state_batch_.updates.erase(this->deferred_state_batch_.updates.begin(), - this->deferred_state_batch_.updates.begin() + processed_count); - // Reschedule for remaining updates - this->schedule_state_batch_(); + // Remove processed items from the batch + if (processed_count < this->deferred_batch_.items.size()) { + // Some items weren't processed, keep them for next batch + this->deferred_batch_.items.erase(this->deferred_batch_.items.begin(), + this->deferred_batch_.items.begin() + processed_count); + // Reschedule for remaining items + this->schedule_batch_(); } else { - // All updates processed - this->deferred_state_batch_.clear(); + // All items processed + this->deferred_batch_.clear(); } }