From 975520949963e5565cb01272c56d0d74df0ce624 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sun, 15 Jun 2025 18:42:40 -0500 Subject: [PATCH] comments --- esphome/core/application.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/esphome/core/application.cpp b/esphome/core/application.cpp index f9d2cf72c6..e1432a1eba 100644 --- a/esphome/core/application.cpp +++ b/esphome/core/application.cpp @@ -252,6 +252,7 @@ void Application::calculate_looping_components_() { } void Application::disable_component_loop(Component *component) { + // This method must be reentrant - components can disable themselves during their own loop() call // Linear search to find component in active section // Most configs have 10-30 looping components (30 is on the high end) // O(n) is acceptable here as we optimize for memory, not complexity @@ -275,6 +276,7 @@ void Application::disable_component_loop(Component *component) { } void Application::enable_component_loop(Component *component) { + // This method must be reentrant - components can re-enable themselves during their own loop() call // Single pass through all components to find and move if needed // With typical 10-30 components, O(n) is faster than maintaining a map const uint16_t size = this->looping_components_.size();