Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.
Go aialertsdashboarddockerdocker-monitoringgohomelabinfrastructure-monitoringkubernetesmonitoringmspproxmoxproxmox-backup-serverproxmox-mail-gatewayproxmox-veself-hostedtruenastypescriptvspherewebhooks
fix(monitoring): clear poll lastError on success so healthy connections drop stale error banners
rcourtman6eaea2fc3a1f
diff --git a/internal/monitoring/monitor.go b/internal/monitoring/monitor.goindex d7d81b82ea..c8484321ce 100644--- a/internal/monitoring/monitor.go+++ b/internal/monitoring/monitor.go@@ -2368,6 +2368,14 @@ func (m *Monitor) recordTaskResult(instanceType InstanceType, instance string, pstatus.LastSuccess = nowstatus.ConsecutiveFailures = 0status.FirstFailureAt = time.Time{}+ // A recorded error means "current outstanding failure", not "last error+ // ever". Clearing it on success keeps downstream consumers honest: the+ // connections aggregator surfaces LastError as a live error banner and+ // derives Unauthorized state from it, so a stale entry would show a+ // red error on a healthy connection forever (#1493).+ status.LastErrorAt = time.Time{}+ status.LastErrorMessage = ""+ status.LastErrorCategory = ""m.mu.Unlock()if breaker != nil {breaker.recordSuccess()diff --git a/internal/monitoring/monitor_polling_test.go b/internal/monitoring/monitor_polling_test.goindex b6fbc7e65e..12ae7c1c47 100644--- a/internal/monitoring/monitor_polling_test.go+++ b/internal/monitoring/monitor_polling_test.go@@ -1308,6 +1308,18 @@ func TestRecordTaskResult_SuccessResetsFailures(t *testing.T) {if !m.pollStatusMap[key].FirstFailureAt.IsZero() {t.Error("expected FirstFailureAt to be reset to zero")}+ // The recorded error must clear too: it means "current outstanding+ // failure", and the connections UI renders it as a live error banner.+ // A stale entry would show a red error on a healthy connection (#1493).+ if m.pollStatusMap[key].LastErrorMessage != "" {+ t.Errorf("expected LastErrorMessage to be cleared, got %q", m.pollStatusMap[key].LastErrorMessage)+ }+ if !m.pollStatusMap[key].LastErrorAt.IsZero() {+ t.Error("expected LastErrorAt to be reset to zero")+ }+ if m.pollStatusMap[key].LastErrorCategory != "" {+ t.Errorf("expected LastErrorCategory to be cleared, got %q", m.pollStatusMap[key].LastErrorCategory)+ }}func TestRecordTaskResult_NilMaps(t *testing.T) {