diff --git a/control/internal/service/registry.go b/control/internal/service/registry.go index 4e53a73..d582a1b 100644 --- a/control/internal/service/registry.go +++ b/control/internal/service/registry.go @@ -1,6 +1,7 @@ package service import ( + "log" "encoding/json" "sort" "strings" @@ -92,6 +93,7 @@ func (s *RegistryService) startGraphPolling() { onlineDevices = append(onlineDevices, dev) } } + log.Printf("[gp] tick total=%d online=%d", len(s.devices), len(onlineDevices)) s.mu.RUnlock() for _, dev := range onlineDevices { @@ -104,6 +106,7 @@ func (s *RegistryService) startGraphPolling() { continue } total, online, down := parseVideoSourceStats(graphs) + log.Printf("[gp] device=%s vs_total=%d vs_online=%d vs_down=%d", dev.DeviceID, total, online, down) s.mu.Lock() // discovery 可能已替换设备指针,更新 registry 中当前对象 if cur, ok := s.devices[dev.DeviceID]; ok { @@ -111,6 +114,9 @@ func (s *RegistryService) startGraphPolling() { cur.VideoSourceTotal = total cur.VideoSourceOnline = online cur.VideoSourceDown = down + log.Printf("[gp] updated %s vs_down=%d", dev.DeviceID, cur.VideoSourceDown) + } else { + log.Printf("[gp] MISSING device %s in registry", dev.DeviceID) } s.mu.Unlock() }