Skip to content

Commit 0b8d8aa

Browse files
committed
fix(scanner): re-enrich the local node on the peer refresh tick
The local node GPU, CPU and memory figures were captured once and then never refreshed. onBrowse deliberately skips our own entry because self is registry-driven, and publishSelf is otherwise only called when the registry moves: a service (un)register, an identity change, an address change. Nothing was left to converge the numbers. Measured on an RTX 3060: a model was loaded and the card went to 9.1 GB, while the directory kept serving the 0.12 GB it held at daemon start. node-info was serving the true value every two seconds the whole time, and the desktop UI showed it, because the UI reads the node directly rather than through this snapshot. Only consumers of the discovery snapshot saw the frozen value. A peer converges because every browse event re-enriches it. Self now converges too, on the same peerRefreshInterval tick that already refreshes addresses, mesh, cluster identity and models. Verified live: load a model, and the directory follows within 20s instead of never. Note that publishSelf emits node-updated unconditionally, so this adds one self update per tick. The alternative is an applyInfo path with a changed check, mirroring applyModels; that is the larger change. Signed-off-by: canja006 <82221082+canja006@users.noreply.github.com>
1 parent 13b6811 commit 0b8d8aa

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

‎services/nvpair-node-scanner/daemon.go‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1467,6 +1467,17 @@ func (d *daemon) refreshPeersLoop(ctx context.Context) {
14671467
}
14681468
d.refreshClusterIdentityOnce()
14691469
d.refreshModelsOnce()
1470+
// Re-enrich self. onBrowse deliberately skips our own entry (self
1471+
// is registry-driven), and publishSelf is otherwise only called
1472+
// when the registry moves -- a service (un)register, an identity
1473+
// or address change. Nothing else refreshes the local node GPU,
1474+
// CPU and memory figures, so they stayed frozen at whatever they
1475+
// were when the daemon started. Observed on an RTX 3060: the card
1476+
// filled to 9.1 GB while the directory kept reporting the 0.12 GB
1477+
// it held at startup, with node-info serving the true value every
1478+
// two seconds the whole time. A peer converges because every
1479+
// browse event re-enriches it; self had no equivalent path.
1480+
d.publishSelf()
14701481
}
14711482
}
14721483
}

0 commit comments

Comments
 (0)