mirror of
https://github.com/blakeblackshear/frigate.git
synced 2025-08-18 13:47:20 +02:00
Change default zmq timeout (#17971)
* update default zmq timeout * use lower default timeout * keep longer timeout for event maintainer * remove default * remove
This commit is contained in:
parent
96d89eb50c
commit
377b78af11
@ -39,9 +39,6 @@ class EventMetadataSubscriber(Subscriber):
|
|||||||
def __init__(self, topic: EventMetadataTypeEnum) -> None:
|
def __init__(self, topic: EventMetadataTypeEnum) -> None:
|
||||||
super().__init__(topic.value)
|
super().__init__(topic.value)
|
||||||
|
|
||||||
def check_for_update(self, timeout: float = 1) -> tuple | None:
|
|
||||||
return super().check_for_update(timeout)
|
|
||||||
|
|
||||||
def _return_object(self, topic: str, payload: tuple) -> tuple:
|
def _return_object(self, topic: str, payload: tuple) -> tuple:
|
||||||
if payload is None:
|
if payload is None:
|
||||||
return (None, None)
|
return (None, None)
|
||||||
|
@ -6,6 +6,8 @@ from typing import Optional
|
|||||||
|
|
||||||
import zmq
|
import zmq
|
||||||
|
|
||||||
|
from frigate.const import FAST_QUEUE_TIMEOUT
|
||||||
|
|
||||||
SOCKET_PUB = "ipc:///tmp/cache/proxy_pub"
|
SOCKET_PUB = "ipc:///tmp/cache/proxy_pub"
|
||||||
SOCKET_SUB = "ipc:///tmp/cache/proxy_sub"
|
SOCKET_SUB = "ipc:///tmp/cache/proxy_sub"
|
||||||
|
|
||||||
@ -77,7 +79,9 @@ class Subscriber:
|
|||||||
self.socket.setsockopt_string(zmq.SUBSCRIBE, self.topic)
|
self.socket.setsockopt_string(zmq.SUBSCRIBE, self.topic)
|
||||||
self.socket.connect(SOCKET_SUB)
|
self.socket.connect(SOCKET_SUB)
|
||||||
|
|
||||||
def check_for_update(self, timeout: float = 1) -> Optional[tuple[str, any]]:
|
def check_for_update(
|
||||||
|
self, timeout: float = FAST_QUEUE_TIMEOUT
|
||||||
|
) -> Optional[tuple[str, any]]:
|
||||||
"""Returns message or None if no update."""
|
"""Returns message or None if no update."""
|
||||||
try:
|
try:
|
||||||
has_update, _, _ = zmq.select([self.socket], [], [], timeout)
|
has_update, _, _ = zmq.select([self.socket], [], [], timeout)
|
||||||
|
@ -231,7 +231,7 @@ class EmbeddingMaintainer(threading.Thread):
|
|||||||
|
|
||||||
def _process_updates(self) -> None:
|
def _process_updates(self) -> None:
|
||||||
"""Process event updates"""
|
"""Process event updates"""
|
||||||
update = self.event_subscriber.check_for_update(timeout=0.01)
|
update = self.event_subscriber.check_for_update()
|
||||||
|
|
||||||
if update is None:
|
if update is None:
|
||||||
return
|
return
|
||||||
@ -324,7 +324,7 @@ class EmbeddingMaintainer(threading.Thread):
|
|||||||
def _process_finalized(self) -> None:
|
def _process_finalized(self) -> None:
|
||||||
"""Process the end of an event."""
|
"""Process the end of an event."""
|
||||||
while True:
|
while True:
|
||||||
ended = self.event_end_subscriber.check_for_update(timeout=0.01)
|
ended = self.event_end_subscriber.check_for_update()
|
||||||
|
|
||||||
if ended == None:
|
if ended == None:
|
||||||
break
|
break
|
||||||
@ -420,7 +420,7 @@ class EmbeddingMaintainer(threading.Thread):
|
|||||||
def _process_recordings_updates(self) -> None:
|
def _process_recordings_updates(self) -> None:
|
||||||
"""Process recordings updates."""
|
"""Process recordings updates."""
|
||||||
while True:
|
while True:
|
||||||
recordings_data = self.recordings_subscriber.check_for_update(timeout=0.01)
|
recordings_data = self.recordings_subscriber.check_for_update()
|
||||||
|
|
||||||
if recordings_data == None:
|
if recordings_data == None:
|
||||||
break
|
break
|
||||||
@ -437,7 +437,7 @@ class EmbeddingMaintainer(threading.Thread):
|
|||||||
|
|
||||||
def _process_event_metadata(self):
|
def _process_event_metadata(self):
|
||||||
# Check for regenerate description requests
|
# Check for regenerate description requests
|
||||||
(topic, payload) = self.event_metadata_subscriber.check_for_update(timeout=0.01)
|
(topic, payload) = self.event_metadata_subscriber.check_for_update()
|
||||||
|
|
||||||
if topic is None:
|
if topic is None:
|
||||||
return
|
return
|
||||||
@ -451,7 +451,7 @@ class EmbeddingMaintainer(threading.Thread):
|
|||||||
|
|
||||||
def _process_dedicated_lpr(self) -> None:
|
def _process_dedicated_lpr(self) -> None:
|
||||||
"""Process event updates"""
|
"""Process event updates"""
|
||||||
(topic, data) = self.detection_subscriber.check_for_update(timeout=0.01)
|
(topic, data) = self.detection_subscriber.check_for_update()
|
||||||
|
|
||||||
if topic is None:
|
if topic is None:
|
||||||
return
|
return
|
||||||
|
@ -75,7 +75,7 @@ class EventProcessor(threading.Thread):
|
|||||||
).execute()
|
).execute()
|
||||||
|
|
||||||
while not self.stop_event.is_set():
|
while not self.stop_event.is_set():
|
||||||
update = self.event_receiver.check_for_update()
|
update = self.event_receiver.check_for_update(timeout=1)
|
||||||
|
|
||||||
if update == None:
|
if update == None:
|
||||||
continue
|
continue
|
||||||
|
Loading…
Reference in New Issue
Block a user