Skip to content

Commit a5ac4c6

Browse files
authored
refactor api issues load attributes for better performance (#1066)
1 parent ab462fb commit a5ac4c6

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

routers/api/v1/repo/issue.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,13 +40,14 @@ func ListIssues(ctx *context.APIContext) {
4040
issues = append(issues, tempIssues...)
4141
}
4242

43-
// FIXME: use IssueList to improve performance.
43+
err = models.IssueList(issues).LoadAttributes()
44+
if err != nil {
45+
ctx.Error(500, "LoadAttributes", err)
46+
return
47+
}
48+
4449
apiIssues := make([]*api.Issue, len(issues))
4550
for i := range issues {
46-
if err = issues[i].LoadAttributes(); err != nil {
47-
ctx.Error(500, "LoadAttributes", err)
48-
return
49-
}
5051
apiIssues[i] = issues[i].APIFormat()
5152
}
5253

0 commit comments

Comments
 (0)