Merge pull request #916 from unpoller/issue-904

Fix authentication retry to prevent data gaps after re-auth
This commit is contained in:
Cody Lee
2026-01-25 11:55:47 -06:00
committed by GitHub
+9 -2
View File
@@ -80,9 +80,16 @@ func (u *InputUnifi) collectController(c *Controller) (*poller.Metrics, error) {
if err != nil {
u.Logf("Re-authenticating to UniFi Controller: %s", c.URL)
if err := u.getUnifi(c); err != nil {
return metrics, fmt.Errorf("re-authenticating to %s: %w", c.URL, err)
if authErr := u.getUnifi(c); authErr != nil {
return metrics, fmt.Errorf("re-authenticating to %s: %w", c.URL, authErr)
}
// Brief delay to allow controller to process new authentication
time.Sleep(500 * time.Millisecond)
// Retry the poll after successful re-authentication
u.LogDebugf("Retrying poll after re-authentication: %s", c.URL)
metrics, err = u.pollController(c)
}
return metrics, err