mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 08:30:25 +08:00 
			
		
		
		
	improve possible performance bottleneck (#28547)
Replace #28500 --------- Co-authored-by: Giteabot <teabot@gitea.io>
This commit is contained in:
		@@ -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
 | 
					// 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 {
 | 
					func UpdateCommentsMigrationsByType(ctx context.Context, tp structs.GitServiceType, originalAuthorID string, posterID int64) error {
 | 
				
			||||||
	_, err := db.GetEngine(ctx).Table("comment").
 | 
						_, err := db.GetEngine(ctx).Table("comment").
 | 
				
			||||||
		Where(builder.In("issue_id",
 | 
							Join("INNER", "issue", "issue.id = comment.issue_id").
 | 
				
			||||||
			builder.Select("issue.id").
 | 
							Join("INNER", "repository", "issue.repo_id = repository.id").
 | 
				
			||||||
				From("issue").
 | 
							Where("repository.original_service_type = ?", tp).
 | 
				
			||||||
				InnerJoin("repository", "issue.repo_id = repository.id").
 | 
					 | 
				
			||||||
				Where(builder.Eq{
 | 
					 | 
				
			||||||
					"repository.original_service_type": tp,
 | 
					 | 
				
			||||||
				}),
 | 
					 | 
				
			||||||
		)).
 | 
					 | 
				
			||||||
		And("comment.original_author_id = ?", originalAuthorID).
 | 
							And("comment.original_author_id = ?", originalAuthorID).
 | 
				
			||||||
		Update(map[string]any{
 | 
							Update(map[string]any{
 | 
				
			||||||
			"poster_id":          posterID,
 | 
								"poster_id":          posterID,
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user