From 5df681697e92d79e6a51125a853d3056c2c30de2 Mon Sep 17 00:00:00 2001 From: George Tsiamasiotis Date: Wed, 2 Oct 2024 11:54:49 +0300 Subject: [PATCH] Use threading Event for process stop Python's multiprocessing.Event does not like being called from signal handlers. Another option would be to start a thread to set the stop_event on receiveSignal, but that seems unnecessary. --- frigate/util/process.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/frigate/util/process.py b/frigate/util/process.py index 531287fc8..886b3d2fb 100644 --- a/frigate/util/process.py +++ b/frigate/util/process.py @@ -3,9 +3,9 @@ import logging import multiprocessing as mp import signal import sys +import threading from functools import wraps from logging.handlers import QueueHandler -from multiprocessing.synchronize import Event from typing import Any import frigate.log @@ -51,12 +51,12 @@ class BaseProcess(mp.Process): class Process(BaseProcess): logger: logging.Logger - stop_event: Event + stop_event: threading.Event @property - def stop_event(self) -> Event: + def stop_event(self) -> threading.Event: if "stop_event" not in self.__dict__: - self.__dict__["stop_event"] = mp.Event() + self.__dict__["stop_event"] = threading.Event() return self.__dict__["stop_event"] def before_start(self) -> None: