diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2024-03-12 12:57:19 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-12 04:57:19 +0000 |
commit | aed3b53abdd02a3ffbf9e8eb90272ff567333073 (patch) | |
tree | 2ec8cd72feea2c1d2a85ac63543b8ad345e0983b /models/issues | |
parent | 75a9f61f89caada64f6398130844281e4f088a73 (diff) | |
download | gitea-aed3b53abdd02a3ffbf9e8eb90272ff567333073.tar.gz gitea-aed3b53abdd02a3ffbf9e8eb90272ff567333073.zip |
Some performance optimization on dashboard and issues page (#29010)
This PR do some loading speed optimization for feeds user interface
pages.
- Load action users batchly but not one by one.
- Load action repositories batchly but not one by one.
- Load action's Repo Owners batchly but not one by one.
- Load action's possible issues batchly but not one by one.
- Load action's possible comments batchly but not one by one.
Diffstat (limited to 'models/issues')
-rw-r--r-- | models/issues/issue_list.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/models/issues/issue_list.go b/models/issues/issue_list.go index a932ac2554..0fb8447ff7 100644 --- a/models/issues/issue_list.go +++ b/models/issues/issue_list.go @@ -476,6 +476,16 @@ func (issues IssueList) loadTotalTrackedTimes(ctx context.Context) (err error) { } trackedTimes := make(map[int64]int64, len(issues)) + reposMap := make(map[int64]*repo_model.Repository, len(issues)) + for _, issue := range issues { + reposMap[issue.RepoID] = issue.Repo + } + repos := repo_model.RepositoryListOfMap(reposMap) + + if err := repos.LoadUnits(ctx); err != nil { + return err + } + ids := make([]int64, 0, len(issues)) for _, issue := range issues { if issue.Repo.IsTimetrackerEnabled(ctx) { |