Skip to content

Commit 0f6dc41

Browse files
ethantkoeniglunny
authored andcommitted
Remove unnecessary IssueList attribute loads (#2936)
1 parent 10b54df commit 0f6dc41

File tree

2 files changed

+16
-9
lines changed

2 files changed

+16
-9
lines changed

models/issue_indexer.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ func populateIssueIndexer() error {
4949
if err != nil {
5050
return err
5151
}
52+
if err = IssueList(issues).LoadComments(); err != nil {
53+
return err
54+
}
5255
for _, issue := range issues {
5356
if err := batch.Add(issue.update()); err != nil {
5457
return err

models/issue_list.go

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,7 @@ func (issues IssueList) loadComments(e Engine) (err error) {
290290
return nil
291291
}
292292

293+
// loadAttributes loads all attributes, expect for attachments and comments
293294
func (issues IssueList) loadAttributes(e Engine) (err error) {
294295
if _, err = issues.loadRepositories(e); err != nil {
295296
return
@@ -315,18 +316,21 @@ func (issues IssueList) loadAttributes(e Engine) (err error) {
315316
return
316317
}
317318

318-
if err = issues.loadAttachments(e); err != nil {
319-
return
320-
}
321-
322-
if err = issues.loadComments(e); err != nil {
323-
return
324-
}
325-
326319
return nil
327320
}
328321

329-
// LoadAttributes loads atrributes of the issues
322+
// LoadAttributes loads attributes of the issues, except for attachments and
323+
// comments
330324
func (issues IssueList) LoadAttributes() error {
331325
return issues.loadAttributes(x)
332326
}
327+
328+
// LoadAttachments loads attachments
329+
func (issues IssueList) LoadAttachments() error {
330+
return issues.loadAttachments(x)
331+
}
332+
333+
// LoadComments loads comments
334+
func (issues IssueList) LoadComments() error {
335+
return issues.loadComments(x)
336+
}

0 commit comments

Comments
 (0)