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)