From 690e2a3aa95cd8a180fc46602e3b560a26769cd1 Mon Sep 17 00:00:00 2001 From: "J. Nick Koston" Date: Sat, 21 Jan 2023 17:06:23 -1000 Subject: [PATCH] review --- src/data/history.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/data/history.ts b/src/data/history.ts index 216f764b29..2c2e93c609 100644 --- a/src/data/history.ts +++ b/src/data/history.ts @@ -238,7 +238,6 @@ class HistoryStream { newHistory[entityId] = []; } for (const entityId of Object.keys(newHistory)) { - let purgeOld = entityId in this.combinedHistory; if ( entityId in this.combinedHistory && entityId in streamMessage.states @@ -257,14 +256,13 @@ class HistoryStream { (a, b) => a.lu - b.lu ); } - purgeOld = true; } else if (entityId in this.combinedHistory) { newHistory[entityId] = this.combinedHistory[entityId]; - purgeOld = true; } else { newHistory[entityId] = streamMessage.states[entityId]; } - if (purgeOld) { + // Remove old history + if (entityId in this.combinedHistory) { const entityHistory = newHistory[entityId]; while (entityHistory[0].lu < purgeBeforePythonTime) { if (entityHistory.length > 1) {