feat(wx-poc): poller 打印归档延迟(msgtime→取到)用于排查 5-6s 弹窗延迟

会话存档消息自带 msgtime(腾讯发送时刻, 毫秒), 与 poller 取到当下之差 ≈
企业微信会话存档归档延迟 + 本地 ≤0.5s 轮询间隔。加一行日志直接印出, 用来
坐实 5-6s 弹窗延迟里哪段是企业微信归档(不可控)、哪段是我们(已测 ~1.5s)。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
zzhyyyyy
2026-07-20 15:48:31 +08:00
parent 4b8ec7c539
commit 641874851c
+8
View File
@@ -94,6 +94,14 @@ def _handle(client: httpx.Client, msg: dict) -> None:
# weapp 卡片按小程序判源平台;image(截图)判不出平台,沿用 meituan。
source = _resolve_source(msg) if msgtype == "weapp" else "meituan"
logger.info("命中触发 from=%s type=%s source=%s", frm, msgtype, source)
# 归档延迟排查: msgtime 是腾讯给的消息发送时刻(毫秒), 与 poller 此刻之差
# ≈ 企业微信会话存档的归档延迟(+ 本地 ≤0.5s 轮询间隔), 用来隔离"是我们慢还是归档慢"。
try:
_msgtime_ms = float(msg.get("msgtime") or 0)
if _msgtime_ms > 0:
logger.info("归档延迟(msgtime→poller取到) ≈ %.2fs", time.time() - _msgtime_ms / 1000.0)
except Exception:
pass
_notify(client, source, msgtype)