mirror of
https://codeberg.org/davrot/forgejo.git
synced 2025-05-17 14:00:01 +02:00
Use for a repo action one database transaction (#19576)
... more context (part of #9307)
This commit is contained in:
parent
730420b6b3
commit
92f139d091
29 changed files with 270 additions and 260 deletions
|
@ -249,7 +249,7 @@ func (comment *Comment) addCrossReferences(stdCtx context.Context, doer *user_mo
|
|||
if comment.Type != CommentTypeCode && comment.Type != CommentTypeComment {
|
||||
return nil
|
||||
}
|
||||
if err := comment.loadIssue(db.GetEngine(stdCtx)); err != nil {
|
||||
if err := comment.LoadIssueCtx(stdCtx); err != nil {
|
||||
return err
|
||||
}
|
||||
ctx := &crossReferencesContext{
|
||||
|
@ -340,9 +340,9 @@ func (comment *Comment) RefIssueIdent() string {
|
|||
// \/ \/ |__| \/ \/
|
||||
|
||||
// ResolveCrossReferences will return the list of references to close/reopen by this PR
|
||||
func (pr *PullRequest) ResolveCrossReferences() ([]*Comment, error) {
|
||||
func (pr *PullRequest) ResolveCrossReferences(ctx context.Context) ([]*Comment, error) {
|
||||
unfiltered := make([]*Comment, 0, 5)
|
||||
if err := db.GetEngine(db.DefaultContext).
|
||||
if err := db.GetEngine(ctx).
|
||||
Where("ref_repo_id = ? AND ref_issue_id = ?", pr.Issue.RepoID, pr.Issue.ID).
|
||||
In("ref_action", []references.XRefAction{references.XRefActionCloses, references.XRefActionReopens}).
|
||||
OrderBy("id").
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue