heartbeat
Verify connection liveness by sending a ping that returns server time and logs idle interval for diagnosing dead connections.
Instructions
Lightweight liveness ping. Returns server time in seconds.
conn.last_heartbeat_at is written without taking
state_lock — a single-float store is GIL-atomic and this
tool fires every ~10s per connection, so paying lock
contention here would dominate the sweeper's cost for no
correctness gain. Documented deliberate carve-out; see
docs/THREADING.md.
Timed: if the server can't even respond to a heartbeat in <200ms, something is blocking the event loop and we want a log line to pin down when it started.
Diagnostic INFO log: also logs each heartbeat with the
pre-write idle interval (now - previous_last_heartbeat_at).
Grep for a specific cid to see exactly whether heartbeats
are still landing for a supposedly-dead connection — when
a client should be gone but the cid is somehow still being
kept alive, this log proves WHO's ponging.
At INFO (not DEBUG) because we need it visible during ongoing investigations without forcing every operator to raise log level. Fires ~once per 10s per connected client — volume is modest.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| connection_id | Yes |