handle exit signals

This commit is contained in:
Blake Blackshear 2021-05-29 13:33:01 -05:00
parent 7a6ffb1032
commit 5afda72b84
2 changed files with 12 additions and 3 deletions

View File

@ -228,7 +228,6 @@ class FrigateApp:
args=(
self.config,
self.video_output_queue,
self.stop_event,
),
)
output_processor.daemon = True

View File

@ -1,13 +1,23 @@
import queue
import signal
import multiprocessing as mp
from multiprocessing import shared_memory
from frigate.util import SharedMemoryFrameManager
def output_frames(config, video_output_queue, stop_event):
def output_frames(config, video_output_queue):
stop_event = mp.Event()
def receiveSignal(signalNumber, frame):
stop_event.set()
signal.signal(signal.SIGTERM, receiveSignal)
signal.signal(signal.SIGINT, receiveSignal)
frame_manager = SharedMemoryFrameManager()
previous_frames = {}
while True:
while not stop_event.is_set():
try:
(
camera,