debug: gp 日志2

This commit is contained in:
tian 2026-08-02 12:37:53 +08:00
parent 497343aac6
commit 452d49b8bc

View File

@ -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()
}