diff --git a/scripts/gateway-watchdog.sh b/scripts/gateway-watchdog.sh index f56b748..33cff2c 100755 --- a/scripts/gateway-watchdog.sh +++ b/scripts/gateway-watchdog.sh @@ -184,7 +184,11 @@ count_rules() { # 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') + if [ -n "$r3_matched" ]; then + R3_COUNT=$(echo "$r3_matched" | wc -l | tr -d '[:space:]') + else + R3_COUNT=0 + fi } # === 主逻辑 ===