fix expiration when event spans the exire date

This commit is contained in:
Blake Blackshear 2021-10-15 07:30:55 -05:00
parent c0e2a75715
commit ef82c5c691

View File

@ -203,7 +203,11 @@ class RecordingCleanup(threading.Thread):
events: Event = ( events: Event = (
Event.select() Event.select()
.where( .where(
Event.camera == camera, Event.end_time < expire_date, Event.has_clip Event.camera == camera,
# need to ensure segments for all events starting
# before the expire date are included
Event.start_time < expire_date,
Event.has_clip,
) )
.order_by(Event.start_time) .order_by(Event.start_time)
.objects() .objects()