1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-27 23:52:28 +01:00
This commit is contained in:
J. Nick Koston
2025-09-02 19:39:49 -05:00
parent 6e14050351
commit be4c8956ad

View File

@@ -127,13 +127,13 @@ void HOT Scheduler::set_timer_common_(Component *component, SchedulerItem::Type
item = std::move(this->scheduler_item_pool_.back());
this->scheduler_item_pool_.pop_back();
#ifdef ESPHOME_DEBUG_SCHEDULER
ESP_LOGVV(TAG, "Reused item from pool (pool size now: %zu)", this->scheduler_item_pool_.size());
ESP_LOGD(TAG, "Reused item from pool (pool size now: %zu)", this->scheduler_item_pool_.size());
#endif
} else {
// Allocate new if pool is empty
item = make_unique<SchedulerItem>();
#ifdef ESPHOME_DEBUG_SCHEDULER
ESP_LOGVV(TAG, "Allocated new item (pool empty)");
ESP_LOGD(TAG, "Allocated new item (pool empty)");
#endif
}
item->component = component;
@@ -819,11 +819,11 @@ void Scheduler::recycle_item_(std::unique_ptr<SchedulerItem> item) {
item->clear_dynamic_name();
this->scheduler_item_pool_.push_back(std::move(item));
#ifdef ESPHOME_DEBUG_SCHEDULER
ESP_LOGVV(TAG, "Recycled item to pool (pool size now: %zu)", this->scheduler_item_pool_.size());
ESP_LOGD(TAG, "Recycled item to pool (pool size now: %zu)", this->scheduler_item_pool_.size());
#endif
} else {
#ifdef ESPHOME_DEBUG_SCHEDULER
ESP_LOGVV(TAG, "Pool full (size: %zu), deleting item", this->scheduler_item_pool_.size());
ESP_LOGD(TAG, "Pool full (size: %zu), deleting item", this->scheduler_item_pool_.size());
#endif
}
// else: unique_ptr will delete the item when it goes out of scope