Fix audio events not being ended (#6981)

* Fix audio events not being ended

* Fix audio events not being ended correctly

* Clean up debug code
This commit is contained in:
Nicolas Mowen 2023-07-01 15:33:47 -06:00 committed by GitHub
parent 7ee17c7af8
commit c25367221e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View File

@ -202,11 +202,13 @@ class AudioEventMaintainer(threading.Thread):
now = datetime.datetime.now().timestamp()
for detection in self.detections.values():
if not detection:
continue
if (
now - detection.get("last_detection", now)
> self.config.audio.max_not_heard
):
del self.detections[detection["label"]]
requests.put(
f"{FRIGATE_LOCALHOST}/api/events/{detection['id']}/end",
json={
@ -214,6 +216,7 @@ class AudioEventMaintainer(threading.Thread):
+ self.config.record.events.post_capture
},
)
self.detections[detection["label"]] = None
def restart_audio_pipe(self) -> None:
try:

View File

@ -239,6 +239,6 @@ class EventProcessor(threading.Thread):
}
try:
Event.update(event).execute()
Event.update(event).where(Event.id == event_data["id"]).execute()
except Exception:
logger.warning(f"Failed to update manual event: {event_data['id']}")