BUG: Event stuck if recording & snapshot disabled while in-progress (#3023)

* Fix recording getting stuck bug

* Fix typo
This commit is contained in:
Nicolas Mowen 2022-03-30 05:33:34 -06:00 committed by GitHub
parent c424c4b7ef
commit 923d07b1a4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -111,6 +111,7 @@ class EventProcessor(threading.Thread):
elif event_type == "end":
if event_data["has_clip"] or event_data["has_snapshot"]:
# Full update for valid end of event
Event.update(
label=event_data["label"],
camera=camera,
@ -126,6 +127,12 @@ class EventProcessor(threading.Thread):
has_clip=event_data["has_clip"],
has_snapshot=event_data["has_snapshot"],
).where(Event.id == event_data["id"]).execute()
else:
# Event ended after clip & snapshot disabled,
# only end time should be updated.
Event.update(
end_time=event_data["end_time"] + event_config.post_capture
).where(Event.id == event_data["id"]).execute()
del self.events_in_process[event_data["id"]]
self.event_processed_queue.put((event_data["id"], camera))