aboutsummaryrefslogtreecommitdiffstats
path: root/models/migrate.go
diff options
context:
space:
mode:
authorsinguliere <35190819+singuliere@users.noreply.github.com>2022-02-07 16:43:08 +0100
committerGitHub <noreply@github.com>2022-02-07 10:43:08 -0500
commit3a91f845e81aae386afb0210f3a66b88109e99a2 (patch)
tree494d14797e95fcc1f93d6f177b1da770a55fc5e8 /models/migrate.go
parent5faf055097135b8532363d9f31d523cb09bff91a (diff)
downloadgitea-3a91f845e81aae386afb0210f3a66b88109e99a2.tar.gz
gitea-3a91f845e81aae386afb0210f3a66b88109e99a2.zip
remove redundant call to UpdateRepoStats during migration (#18591)
There is no need to call UpdateRepoStats in the InsertIssues and InsertPullRequests function. They are only called during migration by the CreateIssues and CreateReviews methods of the gitea uploader. The UpdateRepoStats function will be called by the Finish method of the gitea uploader after all reviews and issues are inserted. Calling it before is therefore redundant and the associated SQL requests are not cheap. The statistics tests done after inserting an issue or a pull request are also removed. They predate the implementation of UpdateRepoStats, back when the calculation of the statistics was an integral part of the migration function. The UpdateRepoStats is now tested independantly and these tests are no longer necessary. Signed-off-by: singuliere <singuliere@autistici.org> Co-authored-by: zeripath <art27@cantab.net> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
Diffstat (limited to 'models/migrate.go')
-rw-r--r--models/migrate.go9
1 files changed, 0 insertions, 9 deletions
diff --git a/models/migrate.go b/models/migrate.go
index 4da426887b..bbfba1fa1e 100644
--- a/models/migrate.go
+++ b/models/migrate.go
@@ -52,10 +52,6 @@ func InsertIssues(issues ...*Issue) error {
return err
}
}
- err = UpdateRepoStats(ctx, issues[0].RepoID)
- if err != nil {
- return err
- }
return committer.Commit()
}
@@ -147,11 +143,6 @@ func InsertPullRequests(prs ...*PullRequest) error {
return err
}
}
-
- err = UpdateRepoStats(ctx, prs[0].Issue.RepoID)
- if err != nil {
- return err
- }
return committer.Commit()
}