From 4995c4e0aed30ff349d847ba84132cffb3a2659f Mon Sep 17 00:00:00 2001 From: junjun Date: Fri, 10 Oct 2025 16:04:37 +0800 Subject: [PATCH] fix: Fix thread blockage for obtaining datasource table or schema --- backend/apps/datasource/api/datasource.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/backend/apps/datasource/api/datasource.py b/backend/apps/datasource/api/datasource.py index 9c182e345..0342ad8d8 100644 --- a/backend/apps/datasource/api/datasource.py +++ b/backend/apps/datasource/api/datasource.py @@ -96,7 +96,10 @@ async def get_tables(session: SessionDep, id: int): @router.post("/getTablesByConf") async def get_tables_by_conf(session: SessionDep, trans: Trans, ds: CoreDatasource): try: - return getTablesByDs(session, ds) + def inner(): + return getTablesByDs(session, ds) + + await asyncio.to_thread(inner) except Exception as e: # check ds status def inner(): @@ -111,7 +114,10 @@ def inner(): @router.post("/getSchemaByConf") async def get_schema_by_conf(session: SessionDep, trans: Trans, ds: CoreDatasource): try: - return get_schema(ds) + def inner(): + return get_schema(ds) + + await asyncio.to_thread(inner) except Exception as e: # check ds status def inner():