hub: add debug logs for smart behavior (#1800)

This commit is contained in:
henrygd
2026-03-28 21:16:26 -04:00
parent 5bd43ed461
commit f25f2469e3
2 changed files with 8 additions and 1 deletions

View File

@@ -145,6 +145,7 @@ func (sys *System) update() error {
// update smart interval if it's set on the agent side
if data.Details.SmartInterval > 0 {
sys.smartInterval = data.Details.SmartInterval
sys.manager.hub.Logger().Info("SMART interval updated from agent details", "system", sys.Id, "interval", sys.smartInterval.String())
// make sure we reset expiration of lastFetch to remain as long as the new smart interval
// to prevent premature expiration leading to new fetch if interval is different.
sys.manager.smartFetchMap.UpdateExpiration(sys.Id, sys.smartInterval+time.Minute)
@@ -157,6 +158,7 @@ func (sys *System) update() error {
sys.smartInterval = time.Hour
}
if sys.shouldFetchSmart() && sys.smartFetching.CompareAndSwap(false, true) {
sys.manager.hub.Logger().Info("SMART fetch", "system", sys.Id, "interval", sys.smartInterval.String())
go func() {
defer sys.smartFetching.Store(false)
_ = sys.FetchAndSaveSmartDevices()