aboutsummaryrefslogtreecommitdiffstats
path: root/models/issues/comment.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2024-03-12 15:23:44 +0800
committerGitHub <noreply@github.com>2024-03-12 07:23:44 +0000
commitd8bd6f34f09bc9a6602bebb33bdc9e1f255a0d7c (patch)
tree1536b715fb816410535893e7ba10279d89119638 /models/issues/comment.go
parentaed3b53abdd02a3ffbf9e8eb90272ff567333073 (diff)
downloadgitea-d8bd6f34f09bc9a6602bebb33bdc9e1f255a0d7c.tar.gz
gitea-d8bd6f34f09bc9a6602bebb33bdc9e1f255a0d7c.zip
Do some performance optimize for issues list and view issue/pull (#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>
Diffstat (limited to 'models/issues/comment.go')
-rw-r--r--models/issues/comment.go8
1 files changed, 2 insertions, 6 deletions
diff --git a/models/issues/comment.go b/models/issues/comment.go
index e37f844b5c..6f65a5dbbc 100644
--- a/models/issues/comment.go
+++ b/models/issues/comment.go
@@ -673,7 +673,8 @@ func (c *Comment) LoadTime(ctx context.Context) error {
return err
}
-func (c *Comment) loadReactions(ctx context.Context, repo *repo_model.Repository) (err error) {
+// LoadReactions loads comment reactions
+func (c *Comment) LoadReactions(ctx context.Context, repo *repo_model.Repository) (err error) {
if c.Reactions != nil {
return nil
}
@@ -691,11 +692,6 @@ func (c *Comment) loadReactions(ctx context.Context, repo *repo_model.Repository
return nil
}
-// LoadReactions loads comment reactions
-func (c *Comment) LoadReactions(ctx context.Context, repo *repo_model.Repository) error {
- return c.loadReactions(ctx, repo)
-}
-
func (c *Comment) loadReview(ctx context.Context) (err error) {
if c.ReviewID == 0 {
return nil