You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
perf(api): /api/status re-integrates today's history on every poll #1145
GET /api/status re-integrates today's history (and the current 15-minute slot) on every 2s dashboard poll. That walks the same hot-tier rows the control tick is writing.
Found on master 6eadec3f. Still true on DuckDB PR #1129: the SQL moved engines, the poll did not.
plus currentGridEnergySlot → another DailyEnergy. The query is UNION ALL of history_hot/warm/cold with LAG (go/internal/state/store.go). Late day at a 2s tick is tens of thousands of hot rows, every poll, concurrent with the writer.
Closed days already hit energy_daily. Today always recomputes. The comment at the handler already records a Pi stall when rows were shipped to Go; the SQL aggregate still visits the same rows.
#882 is the tick-writer side. This is the read side.
What a fix needs
Cache today's running totals between ticks, or increment from the last sample, so /api/status is O(1) or O(new samples).
Keep the existing "no interval yet after midnight → omit totals" guard.
Test: many hot rows, repeated DailyEnergy for today, then a status poll that does not rescan the whole day.
Activity