032: fix run_translation route handler — sync def → async def (asyncio.create_task needs running loop)

run_translation was def (sync FastAPI handler runs in thread pool with no event
loop), but its body calls asyncio.create_task(_background_execute()) which
requires a running event loop. Changed to async def so FastAPI runs it on the
event loop directly.

Error: 'Run failed: no running event loop'
This commit is contained in:
2026-06-05 08:40:46 +03:00
parent 71156783cf
commit 71000db785

View File

@@ -27,7 +27,7 @@ from ._router import router
# @PRE User has translate.job.execute permission.
# @POST Returns the created translation run.
@router.post("/jobs/{job_id}/run", status_code=status.HTTP_201_CREATED)
def run_translation(
async def run_translation(
job_id: str,
full_translation: bool = Query(False, description="Translate ALL rows (skip new-key-only filter)"),
current_user: User = Depends(get_current_user),