From 71000db785cac4598f471a722071512ac2ca604e Mon Sep 17 00:00:00 2001 From: busya Date: Fri, 5 Jun 2026 08:40:46 +0300 Subject: [PATCH] =?UTF-8?q?032:=20fix=20run=5Ftranslation=20route=20handle?= =?UTF-8?q?r=20=E2=80=94=20sync=20def=20=E2=86=92=20async=20def=20(asyncio?= =?UTF-8?q?.create=5Ftask=20needs=20running=20loop)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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' --- backend/src/api/routes/translate/_run_routes.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/api/routes/translate/_run_routes.py b/backend/src/api/routes/translate/_run_routes.py index db1e720b..c005917a 100644 --- a/backend/src/api/routes/translate/_run_routes.py +++ b/backend/src/api/routes/translate/_run_routes.py @@ -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),