forked from forgejo/forgejo
Fix CheckRepoStats and reuse it during migration (#18264)
The CheckRepoStats function missed the following counters: - label num_closed_issues & num_closed_pulls - milestone num_closed_issues & num_closed_pulls The update SQL statements for updating the repository num_closed_issues & num_closed_pulls fields were repeated in three functions (repo.CheckRepoStats, migrate.insertIssues and models.Issue.updateClosedNum) and were moved to a single helper. The UpdateRepoStats is implemented and called in the Finish migration method so that it happens immediately instead of wating for the CheckRepoStats to run. Signed-off-by: Loïc Dachary loic@dachary.org --- [source](https://lab.forgefriends.org/forgefriends/forgefriends/-/merge_requests/34)
This commit is contained in:
parent
7dde39a6db
commit
076cead40d
10 changed files with 219 additions and 168 deletions
|
@ -978,6 +978,10 @@ func (g *GiteaLocalUploader) Finish() error {
|
|||
return err
|
||||
}
|
||||
|
||||
if err := models.UpdateRepoStats(db.DefaultContext, g.repo.ID); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
g.repo.Status = repo_model.RepositoryReady
|
||||
return repo_model.UpdateRepositoryCols(g.repo, "status")
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue