summaryrefslogtreecommitdiffstats
path: root/models/issues/issue_index.go
diff options
context:
space:
mode:
Diffstat (limited to 'models/issues/issue_index.go')
-rw-r--r--models/issues/issue_index.go8
1 files changed, 2 insertions, 6 deletions
diff --git a/models/issues/issue_index.go b/models/issues/issue_index.go
index 100e814317..f4acc5aa1b 100644
--- a/models/issues/issue_index.go
+++ b/models/issues/issue_index.go
@@ -15,16 +15,12 @@ func RecalculateIssueIndexForRepo(repoID int64) error {
}
defer committer.Close()
- if err := db.UpsertResourceIndex(ctx, "issue_index", repoID); err != nil {
- return err
- }
-
var max int64
- if _, err := db.GetEngine(ctx).Select(" MAX(`index`)").Table("issue").Where("repo_id=?", repoID).Get(&max); err != nil {
+ if _, err = db.GetEngine(ctx).Select(" MAX(`index`)").Table("issue").Where("repo_id=?", repoID).Get(&max); err != nil {
return err
}
- if _, err := db.GetEngine(ctx).Exec("UPDATE `issue_index` SET max_index=? WHERE group_id=?", max, repoID); err != nil {
+ if err = db.SyncMaxResourceIndex(ctx, "issue_index", repoID, max); err != nil {
return err
}