Clear ongoing reviews on startup (#11097)

* Add topic to clear ongoing review segments

* Clear ongoing review items on startup
This commit is contained in:
Nicolas Mowen
2024-04-24 08:44:28 -05:00
committed by GitHub
parent 313e7c016c
commit c035241b39
3 changed files with 16 additions and 1 deletions
+6
View File
@@ -1,5 +1,6 @@
"""Handle communication between Frigate and other applications."""
import datetime
import logging
from abc import ABC, abstractmethod
from typing import Any, Callable, Optional
@@ -7,6 +8,7 @@ from typing import Any, Callable, Optional
from frigate.comms.config_updater import ConfigPublisher
from frigate.config import BirdseyeModeEnum, FrigateConfig
from frigate.const import (
CLEAR_ONGOING_REVIEW_SEGMENTS,
INSERT_MANY_RECORDINGS,
INSERT_PREVIEW,
REQUEST_REGION_GRID,
@@ -116,6 +118,10 @@ class Dispatcher:
)
.execute()
)
elif topic == CLEAR_ONGOING_REVIEW_SEGMENTS:
ReviewSegment.update(end_time=datetime.datetime.now().timestamp()).where(
ReviewSegment.end_time == None
).execute()
else:
self.publish(topic, payload, retain=False)