Browse Source

update 外联设备最新数据问题,纪录

dev
lucas 1 month ago
parent
commit
edf995b712
  1. 7
      et_cache/cacheHandler.go
  2. 2
      node/stages/stage.go

7
et_cache/cacheHandler.go

@ -44,6 +44,12 @@ func (the *CacheHandler) enqueue(p *common_models.ProcessData) *common_models.Pr
if !ok { if !ok {
cacheWindow = the.cacheServer.CreatFilterWindow(station.Info.Id, item.FieldName) cacheWindow = the.cacheServer.CreatFilterWindow(station.Info.Id, item.FieldName)
} }
//todo 这里不能跳过 原因:关联公式 比如温补 就靠这个最新的一条进行存储后关联了...
if cacheWindow.MethodId == 0 {
//continue
}
needItemCache := common_models.AnalyzeData{} needItemCache := common_models.AnalyzeData{}
if value, ok := station.Data.ThemeData[item.FieldName]; ok { if value, ok := station.Data.ThemeData[item.FieldName]; ok {
//目前只支持float64类型的缓存 //目前只支持float64类型的缓存
@ -64,6 +70,7 @@ func (the *CacheHandler) enqueue(p *common_models.ProcessData) *common_models.Pr
//缓存 //缓存
cacheWindow.EnQueue(needItemCache) cacheWindow.EnQueue(needItemCache)
the.cacheServer.UpdateCacheMap(cacheItemKey, cacheWindow) the.cacheServer.UpdateCacheMap(cacheItemKey, cacheWindow)
} }
} }
return p return p

2
node/stages/stage.go

@ -59,5 +59,5 @@ func (s *Stage) process(data *common_models.ProcessData) *common_models.ProcessD
} }
func timeCost(nodeId, deviceId string, start time.Time) { func timeCost(nodeId, deviceId string, start time.Time) {
tc := time.Since(start) tc := time.Since(start)
log.Printf("stage[%s] ->[%s]设备数据耗时 = %v", nodeId, deviceId, tc) log.Printf("stage[%s] ->[%s] 耗时 = %v", nodeId, deviceId, tc)
} }

Loading…
Cancel
Save