diff --git a/scripts/gateway-watchdog.sh b/scripts/gateway-watchdog.sh index b557240..1427d45 100755 --- a/scripts/gateway-watchdog.sh +++ b/scripts/gateway-watchdog.sh @@ -52,8 +52,9 @@ count_recent_429() { [ "$fsize" -lt 100 ] && continue # 搜索 429 错误:errorCode=1305 或 errorMessage 含 "429" - local found - found=$(grep -c '"errorCode".*"1305"\|"errorMessage".*"429"' "$jsonl" 2>/dev/null || echo 0) + local found=0 + found=$(grep -c '"errorCode".*"1305"\|"errorMessage".*"429"' "$jsonl" 2>/dev/null || true) + [ -z "$found" ] && found=0 # 进一步过滤:只统计时间窗口内的 if [ "$found" -gt 0 ]; then local recent