aboutsummaryrefslogtreecommitdiffstats
path: root/routers/api/v1
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2017-02-27 08:36:42 +0800
committerGitHub <noreply@github.com>2017-02-27 08:36:42 +0800
commita5ac4c64fcf3de3d9441c241a07ce8610e3f399a (patch)
tree89454d56ac60ab4f96b380365be5c2407a8d4a5d /routers/api/v1
parentab462fb95f7fec5df732a1c60bffe80d86c3b213 (diff)
downloadgitea-a5ac4c64fcf3de3d9441c241a07ce8610e3f399a.tar.gz
gitea-a5ac4c64fcf3de3d9441c241a07ce8610e3f399a.zip
refactor api issues load attributes for better performance (#1066)
Diffstat (limited to 'routers/api/v1')
-rw-r--r--routers/api/v1/repo/issue.go11
1 files changed, 6 insertions, 5 deletions
diff --git a/routers/api/v1/repo/issue.go b/routers/api/v1/repo/issue.go
index c65f4b7063..9afde1f5ed 100644
--- a/routers/api/v1/repo/issue.go
+++ b/routers/api/v1/repo/issue.go
@@ -40,13 +40,14 @@ func ListIssues(ctx *context.APIContext) {
issues = append(issues, tempIssues...)
}
- // FIXME: use IssueList to improve performance.
+ err = models.IssueList(issues).LoadAttributes()
+ if err != nil {
+ ctx.Error(500, "LoadAttributes", err)
+ return
+ }
+
apiIssues := make([]*api.Issue, len(issues))
for i := range issues {
- if err = issues[i].LoadAttributes(); err != nil {
- ctx.Error(500, "LoadAttributes", err)
- return
- }
apiIssues[i] = issues[i].APIFormat()
}