fix(ops): avoid false Cordn announce alerts from SIGPIPE

This commit is contained in:
SkateSpots 2026-10-30 17:44:59 +07:00
parent 20b2b0d676
commit c4a1671f81

View file

@ -53,9 +53,10 @@ avail=$(free -m | awk '/Mem:/{print $7}')
cordn_rejects=$(docker logs --since 15m newlay-newlay-1 2>&1 | grep -c 'cordn rate limit' || true)
[ "${cordn_rejects:-0}" -ge 40 ] && ISSUES+=("cordn rate limits: ${cordn_rejects} rejects in 15m")
if ! docker logs --since 20m newlay-newlay-1 2>&1 | grep -q 'cordn announce'; then
ISSUES+=("cordn coordinator has not announced in 20m")
fi
# `grep -q` + pipefail makes `docker logs` exit 141 on SIGPIPE, which used to
# make this check fire even when an announcement was present. Count instead.
cordn_announce=$(docker logs --since 20m newlay-newlay-1 2>&1 | grep -c 'cordn announce' || true)
[ "${cordn_announce:-0}" -eq 0 ] && ISSUES+=("cordn coordinator has not announced in 20m")
# TLS expiry (Caddy auto-renews; this catches a broken renewal early).
expiry=$(echo | openssl s_client -servername relay.skate-spots.org -connect relay.skate-spots.org:443 2>/dev/null \