From deae82725280e2f568c9df1a21cd396b7746b0af Mon Sep 17 00:00:00 2001 From: mini Date: Thu, 19 Feb 2026 00:43:07 +0800 Subject: [PATCH] fix: run download in thread pool to unblock event loop --- backend/app/routes/download.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/app/routes/download.py b/backend/app/routes/download.py index ca53d9a..6c1d557 100644 --- a/backend/app/routes/download.py +++ b/backend/app/routes/download.py @@ -121,7 +121,8 @@ async def _do_download(task_id: str, url: str, format_id: str): await db.commit() register_task(task_id) - result = download_video(url, format_id, task_id=task_id) + import asyncio + result = await asyncio.to_thread(download_video, url, format_id, None, task_id) video.title = result["title"] video.thumbnail = result["thumbnail"]