fix: run download in thread pool to unblock event loop
This commit is contained in:
@@ -121,7 +121,8 @@ async def _do_download(task_id: str, url: str, format_id: str):
|
|||||||
await db.commit()
|
await db.commit()
|
||||||
|
|
||||||
register_task(task_id)
|
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.title = result["title"]
|
||||||
video.thumbnail = result["thumbnail"]
|
video.thumbnail = result["thumbnail"]
|
||||||
|
|||||||
Reference in New Issue
Block a user