mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-03-10 10:33:11 +03:00
Fix event getting stuck due to only checking current clip / snapshot (#21893)
* Fix event getting stuck due to only checking current clip / snapshot * formatting
This commit is contained in:
parent
a8ab82937b
commit
c9ba851f0d
@ -15,6 +15,16 @@ logger = logging.getLogger(__name__)
|
|||||||
|
|
||||||
def should_update_db(prev_event: Event, current_event: Event) -> bool:
|
def should_update_db(prev_event: Event, current_event: Event) -> bool:
|
||||||
"""If current_event has updated fields and (clip or snapshot)."""
|
"""If current_event has updated fields and (clip or snapshot)."""
|
||||||
|
# If event is ending and was previously saved, always update to set end_time
|
||||||
|
# This ensures events are properly ended even when alerts/detections are disabled
|
||||||
|
# mid-event (which can cause has_clip/has_snapshot to become False)
|
||||||
|
if (
|
||||||
|
prev_event["end_time"] is None
|
||||||
|
and current_event["end_time"] is not None
|
||||||
|
and (prev_event["has_clip"] or prev_event["has_snapshot"])
|
||||||
|
):
|
||||||
|
return True
|
||||||
|
|
||||||
if current_event["has_clip"] or current_event["has_snapshot"]:
|
if current_event["has_clip"] or current_event["has_snapshot"]:
|
||||||
# if this is the first time has_clip or has_snapshot turned true
|
# if this is the first time has_clip or has_snapshot turned true
|
||||||
if not prev_event["has_clip"] and not prev_event["has_snapshot"]:
|
if not prev_event["has_clip"] and not prev_event["has_snapshot"]:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user