mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-09-11 22:12:23 +00:00
40a25f82d1
The cold-startup race: if Pulse and the agent restart together, the monitor has no connection-health data when the agent calls checkRegistrationWithPulse at startup. The server defaults to registered=true (no known-disconnected entry), so the agent skips re-registration even though the token is stale. The node stays broken until the next manual agent restart. Fix: after the initial runProxmoxSetup call, start a background goroutine that waits 2 minutes (giving the monitor time to poll PVE and record failure state), then rechecks every 5 minutes via RunHealthCheck. RunHealthCheck only acts on types that have a local registration marker. Types without a marker are skipped to prevent uncontrolled token rotation when Pulse is temporarily unreachable — those need a full startup setup cycle via RunAll. Together with the two earlier commits this closes all three stale-token scenarios: install-time 401, long-running stale state, and cold-startup race.