Fix PVE connection health key in registration check

The isKnownDisconnected helper was building the key as
instanceType+"-"+instanceName ("pve-delly"), but the PVE
PollProvider's connectionKey function returns the bare instance
name ("delly"). PBS uses "pbs-"+name. The mismatch meant the
disconnected-node check always missed, rendering the server-side
stale-token detection inert.

Fix: use type-specific key construction matching the PollProvider
connectionKey implementations.
This commit is contained in:
rcourtman
2026-04-18 22:37:24 +01:00
parent 40a25f82d1
commit 688bdd4246
+13 -1
View File
@@ -517,6 +517,10 @@ func (h *ConfigHandlers) autoRegisteredNodeExists(ctx context.Context, req *Auto
// entry for the given instance. Returns false (i.e., assume connected) when
// there is no monitor data yet so we don't mistakenly trigger re-registration
// on every cold startup before the monitor has had a chance to poll.
//
// Key format must match the PollProvider connectionKey functions:
// - pve: bare instance name (e.g. "delly")
// - pbs: "pbs-" + instance name
func isKnownDisconnected(connStatuses map[string]bool, instanceType, name, host string) bool {
if connStatuses == nil {
return false
@@ -528,7 +532,15 @@ func isKnownDisconnected(connStatuses map[string]bool, instanceType, name, host
if instanceName == "" {
return false
}
key := instanceType + "-" + instanceName
var key string
switch instanceType {
case "pve":
key = instanceName // PVE connectionKey returns bare name
case "pbs":
key = "pbs-" + instanceName
default:
key = instanceType + "-" + instanceName
}
connected, known := connStatuses[key]
return known && !connected
}