fix(sync): 增量跳过条件去掉+60s缓冲(会造成永久漏消息)

若新消息恰好落在水位后60s内,云客act永远≤wm+60s→每轮跳过→消息永久漏。
act==wm(云客最新==我们最新,同源ms时间戳精确相等)才跳,消除该窗口。

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
浅念
2026-08-21 13:43:42 +08:00
parent 9bca5fc08a
commit 0a161c7b6a
+8 -2
View File
@@ -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)