mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-15 07:35:27 +03:00
Update timouts
This commit is contained in:
parent
157b1771ce
commit
ff36b8b88c
@ -25,9 +25,9 @@ class EmbeddingsResponder:
|
||||
|
||||
def check_for_request(self, process: Callable) -> None:
|
||||
while True: # load all messages that are queued
|
||||
logger.debug("Checking for embeddings requests")
|
||||
print("Checking for embeddings requests")
|
||||
has_message, _, _ = zmq.select([self.socket], [], [], 0.1)
|
||||
logger.debug(f"has a request? {has_message}")
|
||||
print(f"has a request? {has_message}")
|
||||
|
||||
if not has_message:
|
||||
break
|
||||
|
||||
@ -43,6 +43,7 @@ def manage_embeddings(config: FrigateConfig) -> None:
|
||||
listen()
|
||||
|
||||
# Configure Frigate DB
|
||||
print("connecting to db in embed")
|
||||
db = SqliteVecQueueDatabase(
|
||||
config.database.path,
|
||||
pragmas={
|
||||
@ -54,6 +55,7 @@ def manage_embeddings(config: FrigateConfig) -> None:
|
||||
load_vec_extension=True,
|
||||
)
|
||||
models = [Event]
|
||||
print("binding db to model")
|
||||
db.bind(models)
|
||||
|
||||
print("creating embedding maintainer")
|
||||
|
||||
@ -84,7 +84,7 @@ class EmbeddingMaintainer(threading.Thread):
|
||||
def _process_requests(self) -> None:
|
||||
"""Process embeddings requests"""
|
||||
|
||||
def handle_request(topic: str, data: str) -> str:
|
||||
def _handle_request(topic: str, data: str) -> str:
|
||||
print(f"Handling embeddings request of type {topic} with data {data}")
|
||||
|
||||
try:
|
||||
@ -108,11 +108,11 @@ class EmbeddingMaintainer(threading.Thread):
|
||||
except Exception as e:
|
||||
logger.error(f"Unable to handle embeddings request {e}")
|
||||
|
||||
self.embeddings_responder.check_for_request(handle_request)
|
||||
self.embeddings_responder.check_for_request(_handle_request)
|
||||
|
||||
def _process_updates(self) -> None:
|
||||
"""Process event updates"""
|
||||
update = self.event_subscriber.check_for_update()
|
||||
update = self.event_subscriber.check_for_update(timeout=0.1)
|
||||
|
||||
if update is None:
|
||||
return
|
||||
@ -150,7 +150,7 @@ class EmbeddingMaintainer(threading.Thread):
|
||||
def _process_finalized(self) -> None:
|
||||
"""Process the end of an event."""
|
||||
while True:
|
||||
ended = self.event_end_subscriber.check_for_update()
|
||||
ended = self.event_end_subscriber.check_for_update(timeout=0.1)
|
||||
|
||||
if ended == None:
|
||||
break
|
||||
@ -245,7 +245,7 @@ class EmbeddingMaintainer(threading.Thread):
|
||||
|
||||
def _process_event_metadata(self):
|
||||
# Check for regenerate description requests
|
||||
(topic, event_id, source) = self.event_metadata_subscriber.check_for_update()
|
||||
(topic, event_id, source) = self.event_metadata_subscriber.check_for_update(timeout=0.1)
|
||||
|
||||
if topic is None:
|
||||
return
|
||||
|
||||
Loading…
Reference in New Issue
Block a user