From a1e52c51b1b9cc479d895aa4f564a401be483d7c Mon Sep 17 00:00:00 2001 From: Blake Blackshear Date: Wed, 1 Sep 2021 07:06:52 -0500 Subject: [PATCH] dont expire events in two places --- frigate/record.py | 27 --------------------------- 1 file changed, 27 deletions(-) diff --git a/frigate/record.py b/frigate/record.py index 260374b8f..c4e132e1c 100644 --- a/frigate/record.py +++ b/frigate/record.py @@ -196,37 +196,10 @@ class RecordingCleanup(threading.Thread): Event.camera == camera, Event.end_time < expire_date, Event.has_clip ) - # mark has_clip false for all expired events - expired_event_ids = set() - for event in events: - # get the date that this event should expire - expire_days_event = ( - 0 - if not config.record.events.enabled - else config.record.events.retain.objects.get( - event.label, config.record.events.retain.default - ) - ) - expire_before_event = ( - datetime.datetime.now() - datetime.timedelta(days=expire_days_event) - ).timestamp() - # if the event is expired - if event.start_time < expire_before_event: - event.has_clip = False - expired_event_ids.add(event.id) - - if expired_event_ids: - # Update associated events - Event.update(has_clip=False).where( - Event.id.in_(list(expired_event_ids)) - ).execute() - # loop over recordings and see if they overlap with any non-expired events for recording in recordings: keep = False for event in events: - if not event.has_clip: - continue if ( ( # event starts in this segment event.start_time > recording.start_time