From a482160691e2b9b6074611e217f76cc996787819 Mon Sep 17 00:00:00 2001 From: Nicolas Mowen Date: Mon, 6 Nov 2023 05:42:10 -0700 Subject: [PATCH] Cleanup timeline entries (#8489) --- frigate/timeline.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/frigate/timeline.py b/frigate/timeline.py index 1acc8d4f8..cca0b24b7 100644 --- a/frigate/timeline.py +++ b/frigate/timeline.py @@ -102,5 +102,11 @@ class TimelineProcessor(threading.Thread): )[0] Timeline.insert(timeline_entry).execute() elif event_type == "end": - timeline_entry[Timeline.class_type] = "gone" - Timeline.insert(timeline_entry).execute() + if event_data["has_clip"] or event_data["has_snapshot"]: + timeline_entry[Timeline.class_type] = "gone" + Timeline.insert(timeline_entry).execute() + else: + # if event was not saved then the timeline entries should be deleted + Timeline.delete().where( + Timeline.source_id == event_data["id"] + ).execute()