From 8e8ef8378028a3b4d57a0a262c3543d0b0fe1e0c Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sun, 6 Jul 2025 11:05:18 -0500 Subject: [PATCH] cleanup --- esphome/core/scheduler.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/esphome/core/scheduler.cpp b/esphome/core/scheduler.cpp index 2b89d45bc9..14c9768b3c 100644 --- a/esphome/core/scheduler.cpp +++ b/esphome/core/scheduler.cpp @@ -143,7 +143,8 @@ void HOT Scheduler::set_timer_common_(Component *component, SchedulerItem::Type // Cancel existing items this->cancel_item_locked_(component, name_cstr, type); } - // Add new item directly to to_add_ (not using push_ to avoid double-locking) + // Add new item directly to to_add_ + // since we have the lock held this->to_add_.push_back(std::move(item)); } } @@ -354,6 +355,8 @@ void HOT Scheduler::call() { if (item->type == SchedulerItem::INTERVAL) { item->next_execution_ = now + item->interval; + // Add new item directly to to_add_ + // since we have the lock held this->to_add_.push_back(std::move(item)); } }