From bf033c1f0fcc9c5d4d6c244d7dc9b6ab5a18e9ee Mon Sep 17 00:00:00 2001 From: zouap Date: Tue, 14 Jun 2022 11:20:47 +0800 Subject: [PATCH] =?UTF-8?q?=E6=8F=90=E4=BA=A4=E4=BB=A3=E7=A0=81=EF=BC=8C?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E9=94=99=E8=AF=AF=E6=89=93=E5=8D=B0=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zouap --- models/user_business_analysis.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/models/user_business_analysis.go b/models/user_business_analysis.go index 064edf13b..4cd3539d7 100644 --- a/models/user_business_analysis.go +++ b/models/user_business_analysis.go @@ -788,7 +788,7 @@ func refreshUserStaticTable(wikiCountMap map[string]int, tableName string, pageS dateRecordBatch = append(dateRecordBatch, dateRecordAll) if len(dateRecordBatch) >= BATCH_INSERT_SIZE { - insertTable(dateRecordBatch, tableName, statictisSess) + err := insertTable(dateRecordBatch, tableName, statictisSess) insertCount += BATCH_INSERT_SIZE if err != nil { log.Info("insert all data failed." + err.Error()) @@ -804,7 +804,7 @@ func refreshUserStaticTable(wikiCountMap map[string]int, tableName string, pageS } } if len(dateRecordBatch) > 0 { - insertTable(dateRecordBatch, tableName, statictisSess) + err := insertTable(dateRecordBatch, tableName, statictisSess) insertCount += len(dateRecordBatch) if err != nil { log.Info("insert all data failed." + err.Error()) @@ -835,7 +835,7 @@ func updateUserIndex(tableName string, statictisSess *xorm.Session, userId int64 statictisSess.Exec(updateSql) } -func insertTable(dateRecords []UserBusinessAnalysisAll, tableName string, statictisSess *xorm.Session) { +func insertTable(dateRecords []UserBusinessAnalysisAll, tableName string, statictisSess *xorm.Session) error { insertBatchSql := "INSERT INTO public." + tableName + "(id, count_date, code_merge_count, commit_count, issue_count, comment_count, focus_repo_count, star_repo_count, watched_count, gitea_age_month, commit_code_size, commit_dataset_size, " + @@ -854,7 +854,8 @@ func insertTable(dateRecords []UserBusinessAnalysisAll, tableName string, static } } - statictisSess.Exec(insertBatchSql) + _, err := statictisSess.Exec(insertBatchSql) + return err } func RefreshUserStaticAllTabel(wikiCountMap map[string]int, userMetrics map[string]int) { @@ -2060,7 +2061,6 @@ func queryCloudBrainTask(start_unix int64, end_unix int64) (map[int64]int, map[s if cloudTaskRecord.Duration < 100000000 && cloudTaskRecord.Duration > 0 { setMapKey("CloudBrainRunTime", cloudTaskRecord.UserID, int(cloudTaskRecord.Duration), resultItemMap) } - if cloudTaskRecord.Type == 1 { //npu if cloudTaskRecord.JobType == "TRAIN" { setMapKey("NpuTrainJob", cloudTaskRecord.UserID, 1, resultItemMap)