-
-
Notifications
You must be signed in to change notification settings - Fork 6k
Comments list performance optimization #5305
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
f7fa13b
to
a1c66ea
Compare
Codecov Report
@@ Coverage Diff @@
## master #5305 +/- ##
==========================================
+ Coverage 41.45% 41.69% +0.23%
==========================================
Files 414 414
Lines 55571 55970 +399
==========================================
+ Hits 23039 23335 +296
- Misses 29434 29506 +72
- Partials 3098 3129 +31
Continue to review full report at Codecov.
|
models/issue_comment.go
Outdated
return err | ||
} | ||
|
||
func (c *Comment) loadAttachements(e Engine) (err error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/loadAttachements/loadAttachments/g 😉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
a1c66ea
to
25af6ff
Compare
models/issue_comment_list.go
Outdated
return nil | ||
} | ||
|
||
// loadAttributes loads all attributes, expect for attachments and comments |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/expect/except
How does this work for issues with a large number of comments? It looks like this is going to get everything in one go. |
@zeripath This should have better performance than before when the issue has a large number of comments. The PR will reduce many database queries when loading comments attributes. |
9ef3ad9
to
f5856fb
Compare
@lunny can you fix remainig issue with 500 error (see drone tests) |
I think this enhancement may be included in a following rc of 1.7.0 since this is not a bug/security issue. |
@lafriks @JonasFranzDEV will fix this. |
ecac388
to
cdf24fb
Compare
@lafriks @jonasfranz fixed. |
cdf24fb
to
e2cecbb
Compare
e2cecbb
to
66b687e
Compare
It's ready to review. |
models/issue_comment_list.go
Outdated
for _, comment := range comments { | ||
if comment.Issue != nil { | ||
_, ok := issues[comment.Issue.ID] | ||
if !ok { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: This should be like in other functions:
if _, ok := issues[comment.Issue.ID]; !ok {
issues[comment.Issue.ID] = comment.Issue
}
66b687e
to
fe5f0b7
Compare
Will also fix #5297