From f4e7d9ce85fd349f8e5524764a9deb26d708b90e Mon Sep 17 00:00:00 2001 From: cfdaily Date: Tue, 2 Jun 2026 22:07:31 +0800 Subject: [PATCH] auto-sync: 2026-06-02 22:07:31 --- scripts/gateway-watchdog.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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 } # === 主逻辑 ===