Browse Source

refactor api issues load attributes for better performance (#1066)

for-closed-social
Lunny Xiao 7 years ago
committed by GitHub
parent
commit
a5ac4c64fc
1 changed files with 6 additions and 5 deletions
  1. +6
    -5
      routers/api/v1/repo/issue.go

+ 6
- 5
routers/api/v1/repo/issue.go View File

@ -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()
}

Loading…
Cancel
Save