zhangzengfei
2024-05-17 9ee887fce2f87f7a79d0b94640cf1d341a254319
service/device.go
@@ -16,7 +16,7 @@
var deviceAliveCache *expirable.LRU[string, bool]
func init() {
   deviceAliveCache = expirable.NewLRU[string, bool](100, nil, time.Second*60) //过滤指定时间内的重复人物
   deviceAliveCache = expirable.NewLRU[string, bool](100, nil, time.Second*60)
}
type DevReportData struct {
@@ -42,18 +42,17 @@
      return nil
   }
   logger.Info("Start device info report task, server:%s.", config.ForwardConf.ReportServer)
   if config.ForwardConf.ReportServer == "" {
      return errors.New("Server addr is empty!")
      return nil
   }
   logger.Info("Start device info report task, server:%s.", config.ForwardConf.ReportServer)
   var d models.Device
   devices, err := d.FindAll()
   if err != nil {
      return err
   }
   for _, dev := range devices{
      if _, exists := deviceAliveCache.Get(dev.Id); !exists {