| | |
| | | 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 { |
| | |
| | | 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 { |