summaryrefslogtreecommitdiffstats
path: root/models/pull.go
diff options
context:
space:
mode:
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