mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-08-08 13:51:01 +02:00
Cleanup config updater
This commit is contained in:
parent
1fc8d9e1b6
commit
7bce78dc13
@ -33,7 +33,7 @@ class ConfigPublisher:
|
|||||||
class ConfigSubscriber:
|
class ConfigSubscriber:
|
||||||
"""Simplifies receiving an updated config."""
|
"""Simplifies receiving an updated config."""
|
||||||
|
|
||||||
def __init__(self, topic: str, exact=False) -> None:
|
def __init__(self, topic: str, exact: bool = False) -> None:
|
||||||
self.topic = topic
|
self.topic = topic
|
||||||
self.exact = exact
|
self.exact = exact
|
||||||
self.context = zmq.Context()
|
self.context = zmq.Context()
|
||||||
@ -41,7 +41,7 @@ class ConfigSubscriber:
|
|||||||
self.socket.setsockopt_string(zmq.SUBSCRIBE, topic)
|
self.socket.setsockopt_string(zmq.SUBSCRIBE, topic)
|
||||||
self.socket.connect(SOCKET_PUB_SUB)
|
self.socket.connect(SOCKET_PUB_SUB)
|
||||||
|
|
||||||
def check_for_update(self) -> Optional[tuple[str, Any]]:
|
def check_for_update(self) -> tuple[str, Any] | tuple[None, None]:
|
||||||
"""Returns updated config or None if no update."""
|
"""Returns updated config or None if no update."""
|
||||||
try:
|
try:
|
||||||
topic = self.socket.recv_string(flags=zmq.NOBLOCK)
|
topic = self.socket.recv_string(flags=zmq.NOBLOCK)
|
||||||
|
Loading…
Reference in New Issue
Block a user