auto-sync: 2026-06-02 22:07:02

This commit is contained in:
cfdaily
2026-06-02 22:07:02 +08:00
parent 3315722871
commit 58a5d9ec5e
+20 -6
View File
@@ -163,14 +163,28 @@ count_rules() {
return
fi
# R1: 含 "lane task error" 且含 "FailoverError"(两步过滤)
R1_COUNT=$(echo "$recent_lines" | grep "lane task error" | _safe_count "FailoverError" || echo 0)
# R1: 含 "lane task error" 且含 "FailoverError"
local r1_matched
r1_matched=$(echo "$recent_lines" | grep "lane task error" || true)
if [ -n "$r1_matched" ]; then
R1_COUNT=$(echo "$r1_matched" | _safe_count "FailoverError")
else
R1_COUNT=0
fi
# R2: 含 "stalled session" 且含 "recovery=none"(两步过滤)
R2_COUNT=$(echo "$recent_lines" | grep "stalled session" | _safe_count "recovery=none" || echo 0)
# R2: 含 "stalled session" 且含 "recovery=none"
local r2_matched
r2_matched=$(echo "$recent_lines" | grep "stalled session" || true)
if [ -n "$r2_matched" ]; then
R2_COUNT=$(echo "$r2_matched" | _safe_count "recovery=none")
else
R2_COUNT=0
fi
# R3: 含 "rate_limit" 或含 "429"(匹配 JSON 中 rate_limit 关键字或 429 错误码)
R3_COUNT=$(echo "$recent_lines" | _safe_count 'rate_limit|429' || echo 0)
# R3: 含 "rate_limit" 或含 "429"
local r3_matched
r3_matched=$(echo "$recent_lines" | grep -E 'rate_limit|429' || true)
R3_COUNT=$(echo "$r3_matched" | _safe_count 'rate_limit|429')
}
# === 主逻辑 ===