Skip to content

Commit deffe9e

Browse files
authored
Fix datarace in gitea_uploader.go (#19409)
1 parent 9053096 commit deffe9e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

services/migrations/gitea_uploader.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -754,13 +754,13 @@ func (g *GiteaLocalUploader) CreateReviews(reviews ...*base.Review) error {
754754
_ = reader.Close()
755755
_ = writer.Close()
756756
}()
757-
go func() {
757+
go func(comment *base.ReviewComment) {
758758
if err := git.GetRepoRawDiffForFile(g.gitRepo, pr.MergeBase, headCommitID, git.RawDiffNormal, comment.TreePath, writer); err != nil {
759759
// We should ignore the error since the commit maybe removed when force push to the pull request
760760
log.Warn("GetRepoRawDiffForFile failed when migrating [%s, %s, %s, %s]: %v", g.gitRepo.Path, pr.MergeBase, headCommitID, comment.TreePath, err)
761761
}
762762
_ = writer.Close()
763-
}()
763+
}(comment)
764764

765765
patch, _ = git.CutDiffAroundLine(reader, int64((&models.Comment{Line: int64(line + comment.Position - 1)}).UnsignedLine()), line < 0, setting.UI.CodeCommentLines)
766766

0 commit comments

Comments
 (0)