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