修复统计指标数据上传不完整的问题

This commit is contained in:
GoEdgeLab
2021-08-03 14:02:15 +08:00
parent 53a908d709
commit 708649dffd
2 changed files with 8 additions and 5 deletions

2
.gitignore vendored Normal file
View File

@@ -0,0 +1,2 @@
*_plus.go
*-plus.sh

View File

@@ -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 {