atproto relay in zig zlay.waow.tech
relay zig atproto

subscriber: per-phase disconnect counter master

splits connectAndRead's error sites into four labeled phases so we can diagnose which layer is driving the 30/day exhaustion regime change operator flagged in the 2026-05-03 handoff: dns_connect — Io.net.HostName.init or host_name.connect tls_init — websocket.Client.initWithStream (TLS) ws_handshake— client.handshake (WS upgrade) read_loop — readLoopWithHeartbeat (post-handshake stalls) emitted as relay_subscriber_disconnect_total{phase=...}. only handshake-or-earlier phases accumulate to failed_attempts (reset_failures fires after ws_handshake succeeds, before read_loop), so the relative rates of dns_connect / tls_init / ws_handshake vs read_loop tell us whether exhaustion is driven by the reconnect path or post-connect stalls compounding with handshake flakiness. zero behavior change: each `try X` becomes `X catch |e| { count; return e; }`. Co-Authored-By: Claude Opus 4 (1M context) <noreply@anthropic.com>


+47 -7
2 changed files