ensure cache copies when events have ended

This commit is contained in:
Blake Blackshear 2021-11-21 09:43:37 -06:00
parent 6832575643
commit 014e6fc909

View File

@ -110,7 +110,7 @@ class RecordingMaintainer(threading.Thread):
.where(
Event.camera == camera,
(Event.end_time == None)
| (Event.end_time >= recordings[0]["start_time"]),
| (Event.end_time >= recordings[0]["start_time"].timestamp()),
Event.has_clip,
)
.order_by(Event.start_time)
@ -171,7 +171,10 @@ class RecordingMaintainer(threading.Thread):
# if the event is in progress or ends after the recording starts, keep it
# and stop looking at events
if event.end_time is None or event.end_time >= start_time:
if (
event.end_time is None
or event.end_time >= start_time.timestamp()
):
overlaps = True
break