diff --git a/main.py b/main.py index 92585b8..199f907 100644 --- a/main.py +++ b/main.py @@ -100,8 +100,13 @@ class EdgeInferenceService: self._algorithm_manager.reload_all_algorithms() # 配置更新后清理无ROI的摄像头流 self._cleanup_cameras_without_roi() - # 配置更新后动态加载新摄像头流(有ROI的) - self._reload_cameras() + # 配置更新后动态加载新摄像头流(异步执行,不阻塞HTTP响应) + import threading + threading.Thread( + target=self._reload_cameras, + name="CameraReloader", + daemon=True + ).start() self._config_manager.register_callback("config_update", _on_config_update) self._logger.info("配置管理器初始化成功") except Exception as e: