Dynamically set extra config pieces

This commit is contained in:
Nicolas Mowen 2025-06-10 16:54:06 -06:00
parent 3f6969fe3f
commit 427fe05bac
2 changed files with 23 additions and 5 deletions

View File

@ -277,7 +277,9 @@ class FrigateApp:
"synchronous": "NORMAL", # Safe when using WAL https://www.sqlite.org/pragma.html#pragma_synchronous
},
timeout=max(
60, 10 * len([c for c in self.config.cameras.values() if c.enabled])
60,
10
* len([c for c in self.config.cameras.values() if c.enabled_in_config]),
),
load_vec_extension=self.config.semantic_search.enabled,
)
@ -307,7 +309,9 @@ class FrigateApp:
def init_embeddings_client(self) -> None:
genai_cameras = [
c for c in self.config.cameras.values() if c.enabled and c.genai.enabled
c
for c in self.config.cameras.values()
if c.enabled_in_config and c.genai.enabled
]
if (

View File

@ -1,6 +1,7 @@
"""Create and maintain camera processes / management."""
import logging
import multiprocessing as mp
import os
import shutil
import threading
@ -115,12 +116,23 @@ class CameraMaintainer(threading.Thread):
return shm_frame_count
def __start_camera_processor(self, name: str, config: CameraConfig) -> None:
config = self.config.cameras[name]
def __start_camera_processor(
self, name: str, config: CameraConfig, runtime: bool = False
) -> None:
if not config.enabled_in_config:
logger.info(f"Camera processor not started for disabled camera {name}")
return
if runtime:
self.detection_out_events[name] = mp.Event()
self.camera_metrics[name] = CameraMetrics()
self.ptz_metrics[name] = PTZMetrics(autotracker_enabled=False)
self.region_grids[name] = get_camera_regions_grid(
name,
config.detect,
max(self.config.model.width, self.config.model.height),
)
camera_process = FrigateProcess(
target=track_camera,
name=f"camera_processor:{name}",
@ -192,7 +204,9 @@ class CameraMaintainer(threading.Thread):
for update_type, update_config in updates:
if update_type == GlobalConfigUpdateEnum.add_camera:
self.__start_camera_processor(update_config.name, update_config)
self.__start_camera_processor(
update_config.name, update_config, runtime=True
)
self.__start_camera_capture(update_config.name, update_config)
elif update_type == GlobalConfigUpdateEnum.debug_camera:
pass