1
0
mirror of https://github.com/esphome/esphome.git synced 2025-09-14 09:12:19 +01:00

fix last component being charged for stats

This commit is contained in:
J. Nick Koston
2025-06-20 22:02:19 +02:00
parent 9901e2d72e
commit eb6a7cf3b9
3 changed files with 19 additions and 5 deletions

View File

@@ -28,11 +28,7 @@ void RuntimeStatsCollector::record_component_time(Component *component, uint32_t
return;
}
if (current_time >= this->next_log_time_) {
this->log_stats_();
this->reset_stats_();
this->next_log_time_ = current_time + this->log_interval_;
}
// Don't print stats here anymore - let process_pending_stats handle it
}
void RuntimeStatsCollector::log_stats_() {
@@ -82,4 +78,15 @@ void RuntimeStatsCollector::log_stats_() {
}
}
void RuntimeStatsCollector::process_pending_stats(uint32_t current_time) {
if (!this->enabled_ || this->next_log_time_ == 0)
return;
if (current_time >= this->next_log_time_) {
this->log_stats_();
this->reset_stats_();
this->next_log_time_ = current_time + this->log_interval_;
}
}
} // namespace esphome