From 0a161c7b6a6d655ebff9ad639c28aa5af46416a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B5=85=E5=BF=B5?= Date: Fri, 21 Aug 2026 13:43:42 +0800 Subject: [PATCH] =?UTF-8?q?fix(sync):=20=E5=A2=9E=E9=87=8F=E8=B7=B3?= =?UTF-8?q?=E8=BF=87=E6=9D=A1=E4=BB=B6=E5=8E=BB=E6=8E=89+60s=E7=BC=93?= =?UTF-8?q?=E5=86=B2(=E4=BC=9A=E9=80=A0=E6=88=90=E6=B0=B8=E4=B9=85?= =?UTF-8?q?=E6=BC=8F=E6=B6=88=E6=81=AF)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 若新消息恰好落在水位后60s内,云客act永远≤wm+60s→每轮跳过→消息永久漏。 act==wm(云客最新==我们最新,同源ms时间戳精确相等)才跳,消除该窗口。 Co-Authored-By: Claude --- yunke-server/scripts/scrape_via_page.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/yunke-server/scripts/scrape_via_page.py b/yunke-server/scripts/scrape_via_page.py index a8835dd..b91f62b 100644 --- a/yunke-server/scripts/scrape_via_page.py +++ b/yunke-server/scripts/scrape_via_page.py @@ -629,7 +629,10 @@ async def scrape_messages(cookie_str: str, max_conversations: int = 100, full_hi for pair in conversations: wm = watermarks.get(pair, 0) act = cust_activity.get(pair, 0) - if wm > 0 and act > 0 and act <= wm + 60_000: + # 注意:不能用 +60s 缓冲——若新消息恰好落在水位后 60s 内, + # act 永远 ≤ wm+60s → 每轮都跳过 → 该消息**永久漏掉**。 + # act==wm 表示云客最新消息==我们最新消息,精确相等才跳。 + if wm > 0 and act > 0 and act <= wm: skipped += 1 else: kept.append(pair) @@ -1586,7 +1589,10 @@ async def scrape_wa_messages(cookie_str: str, max_conversations: int = 100, full for pair in conversations: wm = watermarks.get(pair, 0) act = cust_activity.get(pair, 0) - if wm > 0 and act > 0 and act <= wm + 60_000: + # 注意:不能用 +60s 缓冲——若新消息恰好落在水位后 60s 内, + # act 永远 ≤ wm+60s → 每轮都跳过 → 该消息**永久漏掉**。 + # act==wm 表示云客最新消息==我们最新消息,精确相等才跳。 + if wm > 0 and act > 0 and act <= wm: skipped += 1 else: kept.append(pair)