Skip to content

Commit 009a1ba

Browse files
committed
fix: Fix thread blockage for obtaining datasource table or schema
1 parent 2022b7a commit 009a1ba

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

backend/apps/datasource/api/datasource.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,10 @@ async def get_tables(session: SessionDep, id: int):
9696
@router.post("/getTablesByConf")
9797
async def get_tables_by_conf(session: SessionDep, trans: Trans, ds: CoreDatasource):
9898
try:
99-
return getTablesByDs(session, ds)
99+
def inner():
100+
return getTablesByDs(session, ds)
101+
102+
await asyncio.to_thread(inner)
100103
except Exception as e:
101104
# check ds status
102105
def inner():
@@ -111,7 +114,10 @@ def inner():
111114
@router.post("/getSchemaByConf")
112115
async def get_schema_by_conf(session: SessionDep, trans: Trans, ds: CoreDatasource):
113116
try:
114-
return get_schema(ds)
117+
def inner():
118+
return get_schema(ds)
119+
120+
await asyncio.to_thread(inner)
115121
except Exception as e:
116122
# check ds status
117123
def inner():

0 commit comments

Comments
 (0)