From e2aab518eddae165b9a7c517fbaddaf692ac4070 Mon Sep 17 00:00:00 2001 From: panlei <2799247126@qq.com> Date: 星期二, 10 九月 2019 18:49:05 +0800 Subject: [PATCH] merge labelFilter --- ruleserver/timeTicker.go | 19 +++++++++---------- 1 files changed, 9 insertions(+), 10 deletions(-) diff --git a/ruleserver/timeTicker.go b/ruleserver/timeTicker.go index 56aa275..ac959e6 100644 --- a/ruleserver/timeTicker.go +++ b/ruleserver/timeTicker.go @@ -3,6 +3,7 @@ import ( "fmt" "ruleprocess/logger" + "ruleprocess/structure" "strings" "time" ) @@ -18,7 +19,7 @@ InitN int // 璧嬪�煎悗灏变笉鍙樼殑鍒濆鍊� BufferFlag int // 缂撳啿瀹归敊浣� 杩炵画n甯alse鎵嶄负false AlarmFlag bool // 鎶ヨ鏍囧織浣� 瀹氭椂鍣ㄥ紑鍚悗绗竴娆℃姤璀︽椂浼氳缃负true 寰�鍚庡啀鏉ユ姤璀︿篃涓嶄細鎻掕繘ES - CacheSdkData ResultMsg // 瀹氭椂鍣ㄧ殑缂撳瓨鏁版嵁 鎸佺画鏃堕棿绫荤殑寮�鍚畾鏃跺櫒鏃惰缂撳瓨涓�甯� + CacheSdkData structure.ResultMsg // 瀹氭椂鍣ㄧ殑缂撳瓨鏁版嵁 鎸佺画鏃堕棿绫荤殑寮�鍚畾鏃跺櫒鏃惰缂撳瓨涓�甯� GroupId string // 鑱斿姩瑙勫垯闇�瑕佽褰曚笅姝ゆ椂鐨勮鍒欑粍id RuleResults []*RuleResult } @@ -28,15 +29,13 @@ Sort int32 // 鎽勫儚鏈哄湪瑙勫垯缁勪腑搴忓彿 Result string // 鎽勫儚鏈鸿繃婊ゆ暟鎹緱鍑虹殑缁撴灉 RuleWithPre string // 鎽勫儚鏈轰箣闂寸殑杩炴帴绗� - CacheData ResultMsg // 缂撳瓨褰撳墠甯ф暟鎹� + CacheData structure.ResultMsg // 缂撳瓨褰撳墠甯ф暟鎹� } func TimeTicker() { - //logger.Info("瀹氭椂鍣ㄦ墽琛屼簡") - //fmt.Println("瀹氭椂鍣ㄦ墽琛屼簡") ticker := time.NewTicker(1 * time.Second) - //go func(ticker *time.Ticker) { - // defer ticker.Stop() + go func(ticker *time.Ticker) { + defer ticker.Stop() for { select { case <-ticker.C: @@ -61,7 +60,7 @@ } } } - //}(ticker) + }(ticker) } func StopTimeTicker() { stopChan <- true @@ -69,7 +68,7 @@ } // 鍒ゆ柇鏄惁绗﹀悎瀹氭椂鍣ㄦ潯浠� -func TimerAlarm(oth *Others, groupId string, result bool) (string) { +func TimerAlarm(oth *structure.Others, groupId string, result bool) (string) { var flagTime string // // 鍒ゆ柇鏈夋棤姝よ鍒欑粍鐨勫畾鏃跺櫒 flag := false @@ -92,7 +91,7 @@ logger.Debug("鈥斺�斺�斺�斺�斺�斺�斺�斺�斺�斺��-------------棣栨绗﹀悎鎸佺画鏃堕棿瑙勫垯骞舵姤璀�") flagTime = "10" timeEle.AlarmFlag = true - oth.CacheData = []ResultMsg{} + oth.CacheData = []structure.ResultMsg{} oth.CacheData = append(oth.CacheData,timeEle.CacheSdkData) oth.TimeLabel = flagTime } @@ -145,7 +144,7 @@ func (p SubList) Less(i, j int) bool { return p[i].Sort < p[j].Sort } // 缁撴瀯浣撴牴鎹煇瀛楁鎺掑簭 -type resultList []*LittleRuleResult +type resultList []*structure.LittleRuleResult func (p resultList) Swap(i, j int) { p[i], p[j] = p[j], p[i] } func (p resultList) Len() int { return len(p) } -- Gitblit v1.8.0