From 1f97b19d216f65b33f31c70ed0538f4612865463 Mon Sep 17 00:00:00 2001 From: guke Date: Mon, 6 Jul 2026 12:53:34 +0800 Subject: [PATCH] =?UTF-8?q?observe:=20=E5=85=B3=E5=81=9C=E6=97=B6=E8=A1=A5?= =?UTF-8?q?=E8=AE=B0=E6=AE=8B=E7=95=99=E4=B8=A2=E5=BC=83=E8=AE=A1=E6=95=B0?= =?UTF-8?q?(=E7=BB=88=E5=AE=A1=20minor:=E8=B4=A6=E4=B8=8D=E4=B8=A2?= =?UTF-8?q?=E5=9C=A8=E5=85=B3=E5=81=9C=E6=9C=9F)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Opus 4.8 (1M context) --- app/core/observe_worker.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/core/observe_worker.py b/app/core/observe_worker.py index ba44a6e..aa41723 100644 --- a/app/core/observe_worker.py +++ b/app/core/observe_worker.py @@ -104,6 +104,9 @@ async def stop_observe_worker(task: asyncio.Task | None) -> None: task.cancel() with contextlib.suppress(asyncio.CancelledError): await task + dropped = take_dropped() # 收口:补记最后一个 flush 窗口累计的丢弃数,不让账丢在关停期 + if dropped: + logger.warning("observe dropped %d events (queue full) before shutdown", dropped) if _client is not None: # worker 已停,安全 drain 剩余并 best-effort 发最后一批(短超时,不卡关停); # 超过一批(BATCH_MAX)的剩余直接丢,不做多轮 flush(best-effort,关停从速)。