aboutsummaryrefslogtreecommitdiffstats
path: root/models/issues/pull_list.go
diff options
context:
space:
mode:
authorBrecht Van Lommel <brecht@blender.org>2023-03-01 20:14:02 +0100
committerGitHub <noreply@github.com>2023-03-01 14:14:02 -0500
commitdf48af22296ccce8e9bd18e5d35c9a3cdf5acb0f (patch)
tree11b0120b5af77ff04ee9c771c279fa944f14bb86 /models/issues/pull_list.go
parent7a5af25592003ddc3017fcd7b822a3e02fc40ef6 (diff)
downloadgitea-df48af22296ccce8e9bd18e5d35c9a3cdf5acb0f.tar.gz
gitea-df48af22296ccce8e9bd18e5d35c9a3cdf5acb0f.zip
Order pull request conflict checking by recently updated, for each push (#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.
Diffstat (limited to 'models/issues/pull_list.go')
-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)
}