From e9f8ef13effac4f076ce0d0bc171054db5a23de6 Mon Sep 17 00:00:00 2001 From: simon Date: Sun, 6 Sep 2026 11:52:31 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20Xvfb=20=E7=AE=A1=E9=81=93=E6=8C=82?= =?UTF-8?q?=E6=AD=BB=E6=A0=B9=E5=9B=A0=E4=BF=AE=E5=A4=8D=20+=20=E6=97=A5?= =?UTF-8?q?=E6=8A=A5=E7=AA=97=E5=8F=A3=20mtime=20=E5=85=9C=E5=BA=95=20+=20?= =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=88=87=E6=8D=A2=20dashscope?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - domestic_crawl_8g.sh: Xvfb 启动脱离管道 fd( list[dict]: continue if pt < cutoff: - continue + # publish_time 质量兜底:部分源(zerohedge/cnbc 等)publish_time + # 仅日期(按 00:00 UTC 处理)或美式日期错位(如 09/05 → 5 月 9 日)。 + # 这类文章在报告非 07:00 运行时易被 25h 窗口误伤。若事件文件本身 + # 是窗口内新生成的(mtime ≥ cutoff,即本次管道刚翻译),予以保留。 + # (2026-09-06 空日报事故教训:窗口 articles=0 → AI 摘要为空) + try: + mtime = datetime.fromtimestamp(fp.stat().st_mtime, tz=UTC) + except OSError: + mtime = None + if mtime is None or mtime < cutoff: + continue articles.append(data) except (json.JSONDecodeError, OSError): pass diff --git a/scripts/domestic_crawl_8g.sh b/scripts/domestic_crawl_8g.sh index a8aae9b..79e1763 100755 --- a/scripts/domestic_crawl_8g.sh +++ b/scripts/domestic_crawl_8g.sh @@ -9,7 +9,7 @@ # # 前置条件: # sudo apt install xvfb -# Xvfb :99 -screen 0 1280x1024x24 & # 首次启动 +# Xvfb :99 -screen 0 1280x1024x24 > logs/xvfb.log 2>&1 & # 首次启动 # HTTP 代理 127.0.0.1:3128 已运行(privoxy) # # 用法: @@ -40,9 +40,16 @@ if [ -f .env ]; then fi # ── 启动 Xvfb(如果尚未运行)── +# ⚠️ Xvfb 的 stdin/stdout/stderr 必须脱离本脚本的 fd 并重定向到日志文件: +# 本脚本常被 `bash xx.sh | tee` 管道包裹调用(domestic_full.sh),而 Xvfb +# 是常驻进程(设计为跨运行复用)。若它继承了管道写端,抓取脚本退出后 +# tee 仍永远收不到 EOF → domestic_full.sh 卡在 M1 → [2/2] 管道与日报 +# 永不执行(2026-09-06 早报缺失事故根因)。 if ! pgrep -x "Xvfb" > /dev/null; then LOG "启动 Xvfb 虚拟显示器 :99 ..." - Xvfb :99 -screen 0 1280x1024x24 -ac +extension RANDR & + mkdir -p logs + Xvfb :99 -screen 0 1280x1024x24 -ac +extension RANDR > logs/xvfb.log 2>&1 & + disown 2>/dev/null || true sleep 1 LOG "Xvfb 已启动 (PID: $(pgrep -x Xvfb))" else