diff options
author | Lunny Xiao <xiaolunwen@gmail.com> | 2023-12-22 06:25:57 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-21 23:25:57 +0100 |
commit | b35d3fddfac389a7be401a63b4e1283dd74af681 (patch) | |
tree | f73c281ee9704de6eef830576e4d1c1d5814627c /models | |
parent | 31426938928c89a9441dcf04b767db60c666e09a (diff) | |
download | gitea-b35d3fddfac389a7be401a63b4e1283dd74af681.tar.gz gitea-b35d3fddfac389a7be401a63b4e1283dd74af681.zip |
improve possible performance bottleneck (#28547)
Replace #28500
---------
Co-authored-by: Giteabot <teabot@gitea.io>
Diffstat (limited to 'models')
-rw-r--r-- | models/issues/comment.go | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/models/issues/comment.go b/models/issues/comment.go index ba5aed9c65..ce5cf5902d 100644 --- a/models/issues/comment.go +++ b/models/issues/comment.go @@ -1161,14 +1161,9 @@ func DeleteComment(ctx context.Context, comment *Comment) error { // UpdateCommentsMigrationsByType updates comments' migrations information via given git service type and original id and poster id func UpdateCommentsMigrationsByType(ctx context.Context, tp structs.GitServiceType, originalAuthorID string, posterID int64) error { _, err := db.GetEngine(ctx).Table("comment"). - Where(builder.In("issue_id", - builder.Select("issue.id"). - From("issue"). - InnerJoin("repository", "issue.repo_id = repository.id"). - Where(builder.Eq{ - "repository.original_service_type": tp, - }), - )). + Join("INNER", "issue", "issue.id = comment.issue_id"). + Join("INNER", "repository", "issue.repo_id = repository.id"). + Where("repository.original_service_type = ?", tp). And("comment.original_author_id = ?", originalAuthorID). Update(map[string]any{ "poster_id": posterID, |