Record poll error in PVE/PBS/PMG poll-result trackers

The deferred recordTaskResult call was passing pollErr as a function
argument, so it captured the value at defer-time (always nil) instead
of the value at execution time. Result: the per-instance pollStatusMap
treated every poll as a success — LastSuccess was set to "now" on
every cycle, ConsecutiveFailures stayed at zero, and the circuit
breaker never opened, even when the staleness tracker (which used a
proper closure) recorded the same poll as a failure.

The connections aggregator derives state from PollStatus.LastSuccess,
so the Connections UI reported broken PVE/PBS/PMG instances as
"active / verified / healthy" while no data was ingested. Wrap the
recordTaskResult call in a defer closure so it reads the live pollErr
at execution time, matching the pollMetrics and stalenessTracker
defers immediately above.
This commit is contained in:
rcourtman 2026-05-08 18:14:20 +01:00
parent 1cc20d5768
commit bf6261adc6
2 changed files with 9 additions and 3 deletions

View file

@ -93,7 +93,9 @@ func (m *Monitor) pollPBSInstance(ctx context.Context, instanceName string, clie
}
}()
}
defer m.recordTaskResult(InstanceTypePBS, instanceName, pollErr)
defer func() {
m.recordTaskResult(InstanceTypePBS, instanceName, pollErr)
}()
// Check if context is cancelled
select {
@ -479,7 +481,9 @@ func (m *Monitor) pollPMGInstance(ctx context.Context, instanceName string, clie
}
}()
}
defer m.recordTaskResult(InstanceTypePMG, instanceName, pollErr)
defer func() {
m.recordTaskResult(InstanceTypePMG, instanceName, pollErr)
}()
select {
case <-ctx.Done():

View file

@ -989,7 +989,9 @@ func (m *Monitor) pollPVEInstance(ctx context.Context, instanceName string, clie
}
}()
}
defer m.recordTaskResult(InstanceTypePVE, instanceName, pollErr)
defer func() {
m.recordTaskResult(InstanceTypePVE, instanceName, pollErr)
}()
// Check if context is cancelled
select {