diff --git a/scripts/gateway-watchdog.sh b/scripts/gateway-watchdog.sh index 0e61bf4..c626d0c 100755 --- a/scripts/gateway-watchdog.sh +++ b/scripts/gateway-watchdog.sh @@ -164,13 +164,13 @@ count_rules() { fi # R1: 含 "lane task error" 且含 "FailoverError"(两步过滤) - R1_COUNT=$(echo "$recent_lines" | grep "lane task error" | _safe_count "FailoverError") + R1_COUNT=$(echo "$recent_lines" | grep "lane task error" | _safe_count "FailoverError" || echo 0) # R2: 含 "stalled session" 且含 "recovery=none"(两步过滤) - R2_COUNT=$(echo "$recent_lines" | grep "stalled session" | _safe_count "recovery=none") + R2_COUNT=$(echo "$recent_lines" | grep "stalled session" | _safe_count "recovery=none" || echo 0) # R3: 含 "rate_limit" 或含 "429"(匹配 JSON 中 rate_limit 关键字或 429 错误码) - R3_COUNT=$(echo "$recent_lines" | _safe_count 'rate_limit|429') + R3_COUNT=$(echo "$recent_lines" | _safe_count 'rate_limit|429' || echo 0) } # === 主逻辑 ===