Skip to content

Commit 1a3803e

Browse files
GiteaBotlunny
andauthored
improve possible performance bottleneck (#28547) (#28578)
Backport #28547 by @lunny Replace #28500 Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
1 parent 1183002 commit 1a3803e

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

models/issues/comment.go

+3-8
Original file line numberDiff line numberDiff line change
@@ -1153,14 +1153,9 @@ func DeleteComment(ctx context.Context, comment *Comment) error {
11531153
// UpdateCommentsMigrationsByType updates comments' migrations information via given git service type and original id and poster id
11541154
func UpdateCommentsMigrationsByType(ctx context.Context, tp structs.GitServiceType, originalAuthorID string, posterID int64) error {
11551155
_, err := db.GetEngine(ctx).Table("comment").
1156-
Where(builder.In("issue_id",
1157-
builder.Select("issue.id").
1158-
From("issue").
1159-
InnerJoin("repository", "issue.repo_id = repository.id").
1160-
Where(builder.Eq{
1161-
"repository.original_service_type": tp,
1162-
}),
1163-
)).
1156+
Join("INNER", "issue", "issue.id = comment.issue_id").
1157+
Join("INNER", "repository", "issue.repo_id = repository.id").
1158+
Where("repository.original_service_type = ?", tp).
11641159
And("comment.original_author_id = ?", originalAuthorID).
11651160
Update(map[string]any{
11661161
"poster_id": posterID,

0 commit comments

Comments
 (0)