mirror of
https://github.com/home-assistant/frontend.git
synced 2025-08-02 22:17:48 +00:00
Merge branch 'streaming_history_hui-graph-header-footer_maps' into remove_legacy_history_calls
This commit is contained in:
commit
ced00a4945
@ -197,19 +197,18 @@ class HistoryStream {
|
||||
// Remove old history
|
||||
if (entityId in this.combinedHistory) {
|
||||
const entityHistory = newHistory[entityId];
|
||||
while (entityHistory[0].lu < purgeBeforePythonTime) {
|
||||
if (entityHistory.length > 1) {
|
||||
if (entityHistory[1].lu < purgeBeforePythonTime) {
|
||||
newHistory[entityId].shift();
|
||||
continue;
|
||||
}
|
||||
}
|
||||
// Update the first entry to the start time state
|
||||
// as we need to preserve the start time state and
|
||||
// only expire the rest of the history as it ages.
|
||||
entityHistory[0].lu = purgeBeforePythonTime;
|
||||
break;
|
||||
const lastEntry = entityHistory[entityHistory.length - 1];
|
||||
const filtered = entityHistory.filter(
|
||||
(ent) => ent.lu < purgeBeforePythonTime
|
||||
);
|
||||
if (filtered.length === 0) {
|
||||
filtered.push(lastEntry);
|
||||
}
|
||||
// Update the first entry to the start time state
|
||||
// as we need to preserve the start time state and
|
||||
// only expire the rest of the history as it ages.
|
||||
filtered[0].lu = purgeBeforePythonTime;
|
||||
newHistory[entityId] = filtered;
|
||||
}
|
||||
}
|
||||
this.combinedHistory = newHistory;
|
||||
|
Loading…
x
Reference in New Issue
Block a user