mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-06-01 04:12:10 +00:00
Do some performance optimize for issues list and view issue/pull (gitea#29515)
This PR do some performance optimzations. - [x] Add `index` for the column `comment_id` of `Attachment` table to accelerate query from the database. - [x] Remove unnecessary database queries when viewing issues. Before some conditions which id = 0 will be sent to the database - [x] Remove duplicated load posters - [x] Batch loading attachements, isread of comments on viewing issue --------- Co-authored-by: Zettat123 <zettat123@gmail.com> Conflicts: models/issues/comment_code.go: function was renamed in Forgejo models/migrations/migrations.go: migration already ported
This commit is contained in:
parent
f8a5d6872c
commit
c9854bee98
8 changed files with 106 additions and 62 deletions
|
@ -169,11 +169,9 @@ func renderConversation(ctx *context.Context, comment *issues_model.Comment, ori
|
|||
}
|
||||
ctx.Data["PageIsPullFiles"] = (origin == "diff")
|
||||
|
||||
for _, c := range comments {
|
||||
if err := c.LoadAttachments(ctx); err != nil {
|
||||
ctx.ServerError("LoadAttachments", err)
|
||||
return
|
||||
}
|
||||
if err := comments.LoadAttachments(ctx); err != nil {
|
||||
ctx.ServerError("LoadAttachments", err)
|
||||
return
|
||||
}
|
||||
|
||||
ctx.Data["IsAttachmentEnabled"] = setting.Attachment.Enabled
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue