From 2a87863d9ca7b6abf4860cd54373bf7adfe5a079 Mon Sep 17 00:00:00 2001 From: liuwei Date: Fri, 17 Apr 2026 10:12:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=BD=AC=E5=9B=BE=E4=BB=BB?= =?UTF-8?q?=E5=8A=A1=E8=BF=94=E5=9B=9E=E6=97=B6=E5=BA=8F=E8=AF=AF=E5=88=A4?= =?UTF-8?q?=EF=BC=9A=E7=AD=89=E5=BE=85runtime=E4=BB=BB=E5=8A=A1=E5=AE=8C?= =?UTF-8?q?=E6=88=90=E5=90=8E=E5=86=8D=E8=BF=94=E5=9B=9E=EF=BC=8C=E9=81=BF?= =?UTF-8?q?=E5=85=8D=E5=85=88=E6=8A=A5=E5=A4=B1=E8=B4=A5=E5=90=8E=E6=88=AA?= =?UTF-8?q?=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- utils/markdown_to_image.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/utils/markdown_to_image.py b/utils/markdown_to_image.py index 9c67301..39c51be 100644 --- a/utils/markdown_to_image.py +++ b/utils/markdown_to_image.py @@ -770,7 +770,11 @@ async def _run_in_md2img_runtime(coro, timeout_seconds: Optional[int] = None): awaitable_future = asyncio.wrap_future(future) if timeout_seconds is not None: return await asyncio.wait_for(awaitable_future, timeout=max(1, int(timeout_seconds))) - return awaitable_future + # 关键修复: + # 之前这里直接 return Future 对象,调用方 await 后只拿到 Future 本身, + # 导致业务层误以为截图已完成,实际截图仍在后台执行,出现“先判失败后截图”的时序错乱。 + # 这里必须等待 Future 完成并返回真实结果,保证调用链严格串行。 + return await awaitable_future def _get_browser_manager() -> _PersistentBrowser: