From 7b6d324ced5d7fb96d693bf1af9c538cc9397da1 Mon Sep 17 00:00:00 2001 From: sunty <1172534965@qq.com> Date: 星期四, 20 八月 2020 19:56:48 +0800 Subject: [PATCH] add thresholdTime --- EsClient.go | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/EsClient.go b/EsClient.go index 4b58c98..96be3c7 100644 --- a/EsClient.go +++ b/EsClient.go @@ -476,7 +476,7 @@ return tmpinfos } -func SourceAggregations(buf [] byte) (sources map[string]interface{}, err error) { +func SourceAggregations(buf [] byte, thresholdTime float64) (sources map[string]interface{}, err error) { s := make(map[string]interface{}) loc, err := time.LoadLocation("Asia/Shanghai") if err != nil { @@ -531,7 +531,7 @@ eTime := tmpTime if startTime != "" { sinTime, _ := time.ParseInLocation("2006-01-02 15:04:05", startTime, loc) - if math.Abs(sinTime.Sub(mTime).Seconds()) <= 20 { + if math.Abs(sinTime.Sub(mTime).Seconds()) <= thresholdTime { startTime = tmpTime hitsSources[len(hitsSources)-1]["endTime"] = tmpTime continue -- Gitblit v1.8.0