aboutsummaryrefslogtreecommitdiffstats
path: root/models
diff options
context:
space:
mode:
authorGiteabot <teabot@gitea.io>2023-03-02 00:12:41 -0500
committerGitHub <noreply@github.com>2023-03-02 13:12:41 +0800
commit4c1e24864ffaa64b2a465cfe5912a73a19ec4c03 (patch)
tree438a4854e882a1d15d8ef2d165b8877f98d825cb /models
parent5d5f907e7fcf1dee4eaca205f8e43f50e5884a58 (diff)
downloadgitea-4c1e24864ffaa64b2a465cfe5912a73a19ec4c03.tar.gz
gitea-4c1e24864ffaa64b2a465cfe5912a73a19ec4c03.zip
Order pull request conflict checking by recently updated, for each push (#23220) (#23225)
Backport #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. Co-authored-by: Brecht Van Lommel <brecht@blender.org> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
Diffstat (limited to 'models')
-rw-r--r--models/issues/pull_list.go1
1 files changed, 1 insertions, 0 deletions
diff --git a/models/issues/pull_list.go b/models/issues/pull_list.go
index f4efd916c8..6c9e8c4e05 100644
--- a/models/issues/pull_list.go
+++ b/models/issues/pull_list.go
@@ -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)
}