When an agent joins, we update last_seen_at in the database but don't set last_heartbeat_db_update in the socket. This causes the heartbeat throttling logic to be out of sync: - On join: DB updated, but last_heartbeat_db_update not set (nil) - First heartbeat: Updates DB again because last_heartbeat_db_update is nil - Subsequent heartbeats: Check if >30s since last DB update - Problem: last_heartbeat_db_update tracks the first heartbeat, not the join DB update This manifests when Phoenix recompiles during development - the channel process continues running with old socket assigns, and if last_heartbeat_db_update is recent, heartbeats won't update the DB. After 10+ minutes without DB updates, the agent appears offline even though it's still connected. Fix: Set last_heartbeat_db_update when we update the DB on join, so the throttling logic accurately tracks the most recent DB update. Reviewed-on: graham/towerops-web#142 |
||
|---|---|---|
| .. | ||
| mix/tasks | ||
| snmpkit | ||
| towerops | ||
| towerops_web | ||
| snmp_lib.ex | ||
| snmp_mgr.ex | ||
| snmpkit.ex | ||
| towerops.ex | ||
| towerops_native.ex | ||
| towerops_web.ex | ||