mirror of
https://gh-proxy.org/https://github.com/klinsmaya/SQLBot.git
synced 2026-11-08 01:06:59 +08:00
fix: Fix thread blockage for obtaining datasource table or schema
This commit is contained in:
@@ -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 @@ async def get_tables_by_conf(session: SessionDep, trans: Trans, ds: CoreDatasour
|
||||
@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():
|
||||
|
||||
Reference in New Issue
Block a user