Skip to content

armgit / Pulse

Public Imported from GitHub
0

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.

Give a replacement backup client its own initial scan

pulse-triage[bot]f1545a19f74b
diff --git a/internal/monitoring/pve_backup_lifecycle_test.go b/internal/monitoring/pve_backup_lifecycle_test.go
index 5ede7724ab..51fd41fd9e 100644
--- a/internal/monitoring/pve_backup_lifecycle_test.go
+++ b/internal/monitoring/pve_backup_lifecycle_test.go
@@ -292,3 +292,23 @@ func TestPVEBackupLifecycleCanceledCollectorsKeepEvidence(t *testing.T) {
}
}
}
+
+func TestPVEBackupLifecycleCompletedReplacementRefreshesImmediately(t *testing.T) {
+ synctest.Test(t, func(t *testing.T) {
+ old := &backupLifecycleClient{label: "old"}
+ m := newBackupLifecycleMonitor(old, "qemu")
+ m.config.BackupPollingInterval = 24 * time.Hour
+ scheduleBackupLifecycle(m, old)
+ synctest.Wait()
+ fresh := &backupLifecycleClient{label: "current"}
+ m.replacePVEClient("site-a", fresh)
+ scheduleBackupLifecycle(m, fresh)
+ synctest.Wait()
+ require.NotZero(t, fresh.calls.Load(), "a completed previous binding must not delay the new client's first scan")
+ for _, row := range m.state.GetSnapshot().PVEBackups.GuestSnapshots {
+ if row.Instance == "site-a" {
+ require.Equal(t, "current", row.Name)
+ }
+ }
+ })
+}
diff --git a/internal/monitoring/pve_backup_poll.go b/internal/monitoring/pve_backup_poll.go
index 434a4b3337..1ccaa2473e 100644
--- a/internal/monitoring/pve_backup_poll.go
+++ b/internal/monitoring/pve_backup_poll.go
@@ -69,8 +69,10 @@ func (m *Monitor) cancelPVEBackupPollLocked(instance string) {
if owner := m.pveBackupPolls[instance]; owner != nil {
owner.cancel()
delete(m.pveBackupPolls, instance)
- delete(m.lastPVEBackupPoll, instance)
}
+ // A newly bound client needs its own first scan even when the old one
+ // completed before replacement and its configured interval has not elapsed.
+ delete(m.lastPVEBackupPoll, instance)
}
// Hold the connection publication reader across local acceptance, never across