aboutsummaryrefslogtreecommitdiffstats
path: root/models/pull.go
diff options
context:
space:
mode:
authorLunny Xiao <xiaolunwen@gmail.com>2021-11-21 23:41:00 +0800
committerGitHub <noreply@github.com>2021-11-21 23:41:00 +0800
commitd710af6669654f27f02b69d7ef1ba563e7d58a90 (patch)
tree9727f468a570106293dc90beb70035180bbb7e8e /models/pull.go
parent0add627182388ac63fd04b94cdf912fb87fd0326 (diff)
downloadgitea-d710af6669654f27f02b69d7ef1ba563e7d58a90.tar.gz
gitea-d710af6669654f27f02b69d7ef1ba563e7d58a90.zip
Remove NewSession method from db.Engine interface (#17577)
* Remove NewSession method from db.Engine interface * Fix bug * Some improvements * Fix bug * Fix test * Use XXXBean instead of XXXExample
Diffstat (limited to 'models/pull.go')
-rw-r--r--models/pull.go9
1 files changed, 5 insertions, 4 deletions
diff --git a/models/pull.go b/models/pull.go
index 3bfebee118..1e1dd13c57 100644
--- a/models/pull.go
+++ b/models/pull.go
@@ -285,11 +285,12 @@ func (pr *PullRequest) getReviewedByLines(writer io.Writer) error {
return nil
}
- sess := db.NewSession(db.DefaultContext)
- defer sess.Close()
- if err := sess.Begin(); err != nil {
+ ctx, committer, err := db.TxContext()
+ if err != nil {
return err
}
+ defer committer.Close()
+ sess := db.GetEngine(ctx)
// Note: This doesn't page as we only expect a very limited number of reviews
reviews, err := findReviews(sess, FindReviewOptions{
@@ -326,7 +327,7 @@ func (pr *PullRequest) getReviewedByLines(writer io.Writer) error {
}
reviewersWritten++
}
- return sess.Commit()
+ return committer.Commit()
}
// GetDefaultSquashMessage returns default message used when squash and merging pull request