mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-04-29 18:17:40 +03:00
Pass stopevent from main start
This commit is contained in:
parent
a22e24f24b
commit
9503e48313
@ -23,6 +23,10 @@ def main() -> None:
|
|||||||
setup_logging(manager)
|
setup_logging(manager)
|
||||||
|
|
||||||
threading.current_thread().name = "frigate"
|
threading.current_thread().name = "frigate"
|
||||||
|
stop_event = mp.Event()
|
||||||
|
|
||||||
|
# send stop event on SIGINT
|
||||||
|
signal.signal(signal.SIGINT, lambda sig, frame: stop_event.set())
|
||||||
|
|
||||||
# Make sure we exit cleanly on SIGTERM.
|
# Make sure we exit cleanly on SIGTERM.
|
||||||
signal.signal(signal.SIGTERM, lambda sig, frame: sys.exit())
|
signal.signal(signal.SIGTERM, lambda sig, frame: sys.exit())
|
||||||
@ -110,7 +114,7 @@ def main() -> None:
|
|||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
|
||||||
# Run the main application.
|
# Run the main application.
|
||||||
FrigateApp(config, manager).start()
|
FrigateApp(config, manager, stop_event).start()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
|||||||
@ -79,10 +79,12 @@ logger = logging.getLogger(__name__)
|
|||||||
|
|
||||||
|
|
||||||
class FrigateApp:
|
class FrigateApp:
|
||||||
def __init__(self, config: FrigateConfig, manager: SyncManager) -> None:
|
def __init__(
|
||||||
|
self, config: FrigateConfig, manager: SyncManager, stop_event: MpEvent
|
||||||
|
) -> None:
|
||||||
self.metrics_manager = manager
|
self.metrics_manager = manager
|
||||||
self.audio_process: Optional[mp.Process] = None
|
self.audio_process: Optional[mp.Process] = None
|
||||||
self.stop_event: MpEvent = mp.Event()
|
self.stop_event = stop_event
|
||||||
self.detection_queue: Queue = mp.Queue()
|
self.detection_queue: Queue = mp.Queue()
|
||||||
self.detectors: dict[str, ObjectDetectProcess] = {}
|
self.detectors: dict[str, ObjectDetectProcess] = {}
|
||||||
self.detection_shms: list[mp.shared_memory.SharedMemory] = []
|
self.detection_shms: list[mp.shared_memory.SharedMemory] = []
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user