From 7917bf55ff75c1ff96c81f2f078512f6f40d895b Mon Sep 17 00:00:00 2001 From: Jason Hunter Date: Tue, 4 Jun 2024 08:39:34 -0400 Subject: [PATCH] Fix unclean shutdown of ZMQ (#11740) --- frigate/comms/detections_updater.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/frigate/comms/detections_updater.py b/frigate/comms/detections_updater.py index 37da1586e..d9022ebab 100644 --- a/frigate/comms/detections_updater.py +++ b/frigate/comms/detections_updater.py @@ -26,9 +26,8 @@ class DetectionProxyRunner(threading.Thread): def run(self) -> None: """Run the proxy.""" - control = self.context.socket(zmq.SUB) + control = self.context.socket(zmq.REP) control.connect(SOCKET_CONTROL) - control.setsockopt_string(zmq.SUBSCRIBE, "") incoming = self.context.socket(zmq.XSUB) incoming.bind(SOCKET_PUB) outgoing = self.context.socket(zmq.XPUB) @@ -46,13 +45,13 @@ class DetectionProxy: def __init__(self) -> None: self.context = zmq.Context() - self.control = self.context.socket(zmq.PUB) + self.control = self.context.socket(zmq.REQ) self.control.bind(SOCKET_CONTROL) self.runner = DetectionProxyRunner(self.context) self.runner.start() def stop(self) -> None: - self.control.send_string("TERMINATE") # tell the proxy to stop + self.control.send("TERMINATE".encode()) # tell the proxy to stop self.runner.join() self.context.destroy()