|
26 | 26 | from langflow.services.database.models.transactions.model import TransactionTable |
27 | 27 | from langflow.services.database.models.user.model import User, UserCreate, UserRead |
28 | 28 | from langflow.services.database.models.vertex_builds.crud import delete_vertex_builds_by_flow_id_unchecked |
29 | | -from langflow.services.deps import get_auth_service, get_db_service, session_scope |
| 29 | +from langflow.services.deps import ( |
| 30 | + get_auth_service, |
| 31 | + get_db_service, |
| 32 | + get_settings_service, |
| 33 | + is_settings_service_initialized, |
| 34 | + session_scope, |
| 35 | +) |
30 | 36 | from lfx.components.input_output import ChatInput |
31 | 37 | from lfx.graph import Graph |
32 | 38 | from lfx.log.logger import logger |
@@ -76,9 +82,23 @@ def disable_mcp_auto_init(): |
76 | 82 | inflating every app-fixture test by ~130s and pushing the heaviest test split past the |
77 | 83 | CI step timeout. Skipping it keeps the boot local and deterministic. |
78 | 84 | """ |
| 85 | + previous_env_value = os.environ.get("LANGFLOW_SKIP_MCP_AUTO_INIT") |
| 86 | + previous_setting = ( |
| 87 | + get_settings_service().settings.skip_mcp_auto_init |
| 88 | + if is_settings_service_initialized() |
| 89 | + else (previous_env_value or "").lower() in {"1", "true", "yes", "on"} |
| 90 | + ) |
| 91 | + |
79 | 92 | os.environ["LANGFLOW_SKIP_MCP_AUTO_INIT"] = "true" |
| 93 | + if is_settings_service_initialized(): |
| 94 | + get_settings_service().set("skip_mcp_auto_init", value=True) |
80 | 95 | yield |
81 | | - os.environ.pop("LANGFLOW_SKIP_MCP_AUTO_INIT", None) |
| 96 | + if previous_env_value is None: |
| 97 | + os.environ.pop("LANGFLOW_SKIP_MCP_AUTO_INIT", None) |
| 98 | + else: |
| 99 | + os.environ["LANGFLOW_SKIP_MCP_AUTO_INIT"] = previous_env_value |
| 100 | + if is_settings_service_initialized(): |
| 101 | + get_settings_service().set("skip_mcp_auto_init", previous_setting) |
82 | 102 |
|
83 | 103 |
|
84 | 104 | # TODO: Revert this to True once bb.functions[func].can_block_in("http/client.py", "_safe_read") is fixed |
|
0 commit comments