mirror of
https://github.com/blakeblackshear/frigate.git
synced 2024-11-21 19:07:46 +01:00
Fix unclean shutdown of ZMQ (#11740)
This commit is contained in:
parent
ea0292b911
commit
7917bf55ff
@ -26,9 +26,8 @@ class DetectionProxyRunner(threading.Thread):
|
|||||||
|
|
||||||
def run(self) -> None:
|
def run(self) -> None:
|
||||||
"""Run the proxy."""
|
"""Run the proxy."""
|
||||||
control = self.context.socket(zmq.SUB)
|
control = self.context.socket(zmq.REP)
|
||||||
control.connect(SOCKET_CONTROL)
|
control.connect(SOCKET_CONTROL)
|
||||||
control.setsockopt_string(zmq.SUBSCRIBE, "")
|
|
||||||
incoming = self.context.socket(zmq.XSUB)
|
incoming = self.context.socket(zmq.XSUB)
|
||||||
incoming.bind(SOCKET_PUB)
|
incoming.bind(SOCKET_PUB)
|
||||||
outgoing = self.context.socket(zmq.XPUB)
|
outgoing = self.context.socket(zmq.XPUB)
|
||||||
@ -46,13 +45,13 @@ class DetectionProxy:
|
|||||||
|
|
||||||
def __init__(self) -> None:
|
def __init__(self) -> None:
|
||||||
self.context = zmq.Context()
|
self.context = zmq.Context()
|
||||||
self.control = self.context.socket(zmq.PUB)
|
self.control = self.context.socket(zmq.REQ)
|
||||||
self.control.bind(SOCKET_CONTROL)
|
self.control.bind(SOCKET_CONTROL)
|
||||||
self.runner = DetectionProxyRunner(self.context)
|
self.runner = DetectionProxyRunner(self.context)
|
||||||
self.runner.start()
|
self.runner.start()
|
||||||
|
|
||||||
def stop(self) -> None:
|
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.runner.join()
|
||||||
self.context.destroy()
|
self.context.destroy()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user