From edf995b712d3c6e75b50596e4e0155b49cece0b8 Mon Sep 17 00:00:00 2001 From: lucas Date: Thu, 19 Sep 2024 17:17:00 +0800 Subject: [PATCH] =?UTF-8?q?update=20=20=E5=A4=96=E8=81=94=E8=AE=BE?= =?UTF-8?q?=E5=A4=87=E6=9C=80=E6=96=B0=E6=95=B0=E6=8D=AE=E9=97=AE=E9=A2=98?= =?UTF-8?q?,=E7=BA=AA=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- et_cache/cacheHandler.go | 9 ++++++++- node/stages/stage.go | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/et_cache/cacheHandler.go b/et_cache/cacheHandler.go index d4d8f82..6d8ad9a 100644 --- a/et_cache/cacheHandler.go +++ b/et_cache/cacheHandler.go @@ -38,12 +38,18 @@ func (the *CacheHandler) enqueue(p *common_models.ProcessData) *common_models.Pr if _, ok := itemV.(string); ok { continue } - + cacheItemKey := fmt.Sprintf("%s:%d:%s", redisKey.CacheWindow, station.Info.Id, item.FieldName) cacheWindow, ok := the.cacheServer.ReadCacheMap(station.Info.Id, item.FieldName) if !ok { cacheWindow = the.cacheServer.CreatFilterWindow(station.Info.Id, item.FieldName) } + + //todo 这里不能跳过 原因:关联公式 比如温补 就靠这个最新的一条进行存储后关联了... + if cacheWindow.MethodId == 0 { + //continue + } + needItemCache := common_models.AnalyzeData{} if value, ok := station.Data.ThemeData[item.FieldName]; ok { //目前只支持float64类型的缓存 @@ -64,6 +70,7 @@ func (the *CacheHandler) enqueue(p *common_models.ProcessData) *common_models.Pr //缓存 cacheWindow.EnQueue(needItemCache) the.cacheServer.UpdateCacheMap(cacheItemKey, cacheWindow) + } } return p diff --git a/node/stages/stage.go b/node/stages/stage.go index eb8d4c8..dfec71c 100644 --- a/node/stages/stage.go +++ b/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) { tc := time.Since(start) - log.Printf("stage[%s] ->[%s]设备数据耗时 = %v", nodeId, deviceId, tc) + log.Printf("stage[%s] ->[%s] 耗时 = %v", nodeId, deviceId, tc) }