From 94fd36027b51bc08dd9f4945148c8386115facca Mon Sep 17 00:00:00 2001 From: ThearchyHelios Date: Mon, 19 Oct 2026 13:42:10 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95=EF=BC=9A=E9=9A=94=E7=A6=BB?= =?UTF-8?q?=E9=82=A3=E4=B8=A4=E6=9D=A1=E5=85=88=E7=AD=89=20slow=20?= =?UTF-8?q?=E5=89=8D=E9=9D=A2=E9=82=A3=E4=B8=80=E6=AD=A5=E7=9A=84=E6=96=AD?= =?UTF-8?q?=E7=82=B9=E8=90=BD=E5=BA=93=E5=86=8D=E8=A3=85=E3=80=8C=E5=8D=A1?= =?UTF-8?q?=E4=BD=8F=E3=80=81=E8=A2=AB=E6=8E=A5=E6=89=8B=E3=80=8D=E2=80=94?= =?UTF-8?q?=E2=80=94LangGraph=20=E5=AD=98=E6=96=AD=E7=82=B9=E5=92=8C?= =?UTF-8?q?=E4=B8=8B=E4=B8=80=E6=AD=A5=E5=B9=B6=E8=A1=8C=EF=BC=8CPostgreSQ?= =?UTF-8?q?L=20=E5=85=A8=E9=87=8F=E6=BB=A1=E8=BD=BD=E6=97=B6=20slow=20?= =?UTF-8?q?=E5=B7=B2=E7=BB=8F=E5=BC=80=E5=A7=8B=E3=80=81=E6=96=AD=E7=82=B9?= =?UTF-8?q?=E8=BF=98=E5=9C=A8=E5=86=99=EF=BC=8C=E4=B8=80=E9=9A=94=E7=A6=BB?= =?UTF-8?q?=E9=82=A3=E6=AC=A1=E5=86=99=E5=85=A5=E5=B0=B1=E8=A2=AB=E6=8B=A6?= =?UTF-8?q?=E4=B8=8B=EF=BC=8C=E6=8E=A5=E6=89=8B=E7=9A=84=E4=B8=80=E8=BE=B9?= =?UTF-8?q?=E6=89=BE=E4=B8=8D=E5=88=B0=E6=96=AD=E7=82=B9=EF=BC=88=E5=81=B6?= =?UTF-8?q?=E5=8F=91=E3=80=8C=E6=B2=A1=E6=9C=89=E5=8F=AF=E7=BB=A7=E7=BB=AD?= =?UTF-8?q?=E7=9A=84=E6=96=AD=E7=82=B9=E3=80=8D=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/tests/test_cluster_fence.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/backend/tests/test_cluster_fence.py b/backend/tests/test_cluster_fence.py index 902e81fe..f963e9c6 100644 --- a/backend/tests/test_cluster_fence.py +++ b/backend/tests/test_cluster_fence.py @@ -83,9 +83,21 @@ async def _no_repeated_seq(run_id: str) -> None: assert rows == [], f"撞号:{rows}" +async def _checkpointed_before_slow(run_id: str) -> None: + """等 slow 前面那一步的断点落了库(LangGraph 存断点和下一步并行:慢一点的库上 slow 已经开始、断点还在写)。""" + config = {"configurable": {"thread_id": run_id}} + for _ in range(300): + tup = await run_manager.checkpointer.aget_tuple(config) + if tup is not None and int((tup.metadata or {}).get("step", -1)) >= 1: + return + await asyncio.sleep(0.02) + raise AssertionError("slow 前面那一步的断点一直没落库") + + async def _stall_and_take_over(slow) -> str: run = await run_manager.start(graph=GRAPH, input_payload={"question": "q"}) await asyncio.wait_for(slow["entered"].wait(), timeout=15) + await _checkpointed_before_slow(run.id) before = fence.generation() fence.renewed(time.monotonic() - lease_s() - 1) # 卡了一个多租约时长 await _taken_over(run.id)