mirror of
				https://github.com/TeaOSLab/EdgeNode.git
				synced 2025-11-04 07:40:56 +08:00 
			
		
		
		
	修复统计指标数据上传不完整的问题
This commit is contained in:
		
							
								
								
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,2 @@
 | 
			
		||||
*_plus.go
 | 
			
		||||
*-plus.sh
 | 
			
		||||
@@ -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 {
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user