修复转图任务返回时序误判:等待runtime任务完成后再返回,避免先报失败后截图
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user