From cb3f2edf50837614117cd482345394b4fe36ce6e Mon Sep 17 00:00:00 2001 From: Graham McIntire Date: Wed, 11 Feb 2026 13:54:23 -0600 Subject: [PATCH] polling fix --- CHANGELOG.txt | 11 +++++++++++ CLAUDE.md | 11 ++++++++++- lib/towerops_web/channels/agent_channel.ex | 2 ++ 3 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 CHANGELOG.txt diff --git a/CHANGELOG.txt b/CHANGELOG.txt new file mode 100644 index 00000000..cdaa3286 --- /dev/null +++ b/CHANGELOG.txt @@ -0,0 +1,11 @@ +CHANGELOG - towerops-web +======================== + +2026-02-11 - fix: update last_snmp_poll_at for agent-polled devices + - File: lib/towerops_web/channels/agent_channel.ex (process_polling_result/3) + - Bug: Devices polled by remote agents showed "Last Polled: Never" because + process_polling_result never called Devices.update_snmp_poll_time/1 + - The Phoenix-side DevicePollerWorker already had this call (line 172), + but the agent channel path was missing it + - Fix: Added Devices.update_snmp_poll_time(device) at the top of + process_polling_result/3, matching the DevicePollerWorker pattern diff --git a/CLAUDE.md b/CLAUDE.md index a3b2b200..19814ad8 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1010,4 +1010,13 @@ When writing new LiveView code or JavaScript hooks: - assets are rebuilt automatically on filesystem change - never try to run npm, it's not included in phoenix - assets build themselves on file change, you do not need to ever run mix assets.build -- never write custom one-off tests, if you're going to write a test, write a proper exunit test \ No newline at end of file +- never write custom one-off tests, if you're going to write a test, write a proper exunit test + +## Changelog + +After every code change, append an entry to `CHANGELOG.txt` in the project root. Each entry must include: +- Date (YYYY-MM-DD) +- Short description (e.g. "fix: update last_snmp_poll_at for agent-polled devices") +- Files changed and a brief explanation of what and why + +Keep entries in reverse chronological order (newest at top, below the header). Never remove existing entries. \ No newline at end of file diff --git a/lib/towerops_web/channels/agent_channel.ex b/lib/towerops_web/channels/agent_channel.ex index 47ea5049..7ac694f7 100644 --- a/lib/towerops_web/channels/agent_channel.ex +++ b/lib/towerops_web/channels/agent_channel.ex @@ -1303,6 +1303,8 @@ defmodule ToweropsWeb.AgentChannel do end defp process_polling_result(device, result, _socket) do + Devices.update_snmp_poll_time(device) + snmp_device = device.snmp_device oid_values = Map.new(result.oid_values) # Use server time to avoid clock drift issues between agents