Skip to content

Commit

Permalink
Order pull request conflict checking by recently updated, for each pu…
Browse files Browse the repository at this point in the history
…sh (#23220)

When a change is pushed to the default branch and many pull requests are
open for that branch, conflict checking can take some time.

Previously it would go from oldest to newest pull request. Now
prioritize pull requests that are likely being actively worked on or
prepared for merging.

This only changes the order within one push to one repository, but the
change is trivial and can already be quite helpful for smaller Gitea
instances where a few repositories have most pull requests. A global
order would require deeper changes to queues.
  • Loading branch information
brechtvl authored Mar 1, 2023
1 parent 7a5af25 commit df48af2
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions models/issues/pull_list.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ func GetUnmergedPullRequestsByBaseInfo(repoID int64, branch string) ([]*PullRequ
return prs, db.GetEngine(db.DefaultContext).
Where("base_repo_id=? AND base_branch=? AND has_merged=? AND issue.is_closed=?",
repoID, branch, false, false).
OrderBy("issue.updated_unix DESC").
Join("INNER", "issue", "issue.id=pull_request.issue_id").
Find(&prs)
}
Expand Down

0 comments on commit df48af2

Please sign in to comment.