Filter out on-going events

Unifi Protect has started to return events that have not ended. These are now explicitly filtered out
This commit is contained in:
Sebastian Goscik
2024-10-26 22:12:24 +01:00
parent 2c43149c99
commit c067dbd9f7

View File

@@ -77,9 +77,11 @@ class MissingEventChecker:
if not events_chunk:
break # There were no events to backup
assert events_chunk[-1].end is not None
start_time = events_chunk[-1].end
unifi_events = {event.id: event for event in events_chunk}
# Filter out on-going events
unifi_events = {event.id: event for event in events_chunk if event.end is not None}
# Next chunks start time should be the end of the oldest complete event in the current chunk
start_time = max([event.end for event in unifi_events.values()])
# Get list of events that have been backed up from the database