From 684ba7082b87c3218c5a20187eef8dc0d558848b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E7=A5=A5=E8=B6=85?= Date: Tue, 3 Aug 2021 14:02:15 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=BB=9F=E8=AE=A1=E6=8C=87?= =?UTF-8?q?=E6=A0=87=E6=95=B0=E6=8D=AE=E4=B8=8A=E4=BC=A0=E4=B8=8D=E5=AE=8C?= =?UTF-8?q?=E6=95=B4=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 2 ++ internal/metrics/task.go | 11 ++++++----- 2 files changed, 8 insertions(+), 5 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..dc6e5bb --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +*_plus.go +*-plus.sh \ No newline at end of file diff --git a/internal/metrics/task.go b/internal/metrics/task.go index 6dfb993..525179e 100644 --- a/internal/metrics/task.go +++ b/internal/metrics/task.go @@ -131,7 +131,7 @@ ON "` + this.statTableName + `" ( } // select topN stmt - this.selectTopStmt, err = db.Prepare(`SELECT "id", "hash", "keys", "value", "isUploaded" FROM "` + this.statTableName + `" WHERE "serverId"=? AND "version"=? AND time=? ORDER BY "value" DESC LIMIT 100`) + this.selectTopStmt, err = db.Prepare(`SELECT "id", "hash", "keys", "value", "isUploaded" FROM "` + this.statTableName + `" WHERE "serverId"=? AND "version"=? AND time=? ORDER BY "value" DESC LIMIT 20`) if err != nil { return err } @@ -354,8 +354,7 @@ func (this *Task) Upload(pauseDuration time.Duration) error { var pbStats []*pb.UploadingMetricStat for rows.Next() { - var pbStat = &pb.UploadingMetricStat{ - } + var pbStat = &pb.UploadingMetricStat{} // "id", "hash", "keys", "value", "isUploaded" var isUploaded int var keysData []byte @@ -363,9 +362,11 @@ func (this *Task) Upload(pauseDuration time.Duration) error { if err != nil { return nil, err } - if isUploaded == 1 { + + // TODO 先不判断是否已经上传,需要改造API进行配合 + /**if isUploaded == 1 { continue - } + }**/ if len(keysData) > 0 { err = json.Unmarshal(keysData, &pbStat.Keys) if err != nil {