Skip to content

Commit 041436d

Browse files
lunnyGiteaBot
authored andcommitted
improve possible performance bottleneck (go-gitea#28547)
Replace go-gitea#28500 --------- Co-authored-by: Giteabot <teabot@gitea.io>
1 parent 8b0cb4a commit 041436d

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
@@ -1161,14 +1161,9 @@ func DeleteComment(ctx context.Context, comment *Comment) error {
11611161
// UpdateCommentsMigrationsByType updates comments' migrations information via given git service type and original id and poster id
11621162
func UpdateCommentsMigrationsByType(ctx context.Context, tp structs.GitServiceType, originalAuthorID string, posterID int64) error {
11631163
_, err := db.GetEngine(ctx).Table("comment").
1164-
Where(builder.In("issue_id",
1165-
builder.Select("issue.id").
1166-
From("issue").
1167-
InnerJoin("repository", "issue.repo_id = repository.id").
1168-
Where(builder.Eq{
1169-
"repository.original_service_type": tp,
1170-
}),
1171-
)).
1164+
Join("INNER", "issue", "issue.id = comment.issue_id").
1165+
Join("INNER", "repository", "issue.repo_id = repository.id").
1166+
Where("repository.original_service_type = ?", tp).
11721167
And("comment.original_author_id = ?", originalAuthorID).
11731168
Update(map[string]any{
11741169
"poster_id": posterID,

0 commit comments

Comments
 (0)