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:
@@ -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
|
Reference in New Issue
Block a user