mirror of
https://github.com/go-gitea/gitea
synced 2025-07-07 11:07:20 +00:00
Option to delay conflict checking of old pull requests until page view (#27779)
`[repository.pull-request] DELAY_CHECK_FOR_INACTIVE_DAYS` is a new setting to delay the mergeable check for pull requests that have been inactive for the specified number of days. This avoids potentially long delays for big repositories with many pull requests. and reduces system load overall when there are many repositories or pull requests. When viewing the PR, checking will start immediately and the PR merge box will automatically reload when complete. Accessing the PR through the API will also start checking immediately. The default value of `7` provides a balance between system load, and keeping behavior similar to what it was before both for users and API access. With `0` all conflict checking will be delayed, while `-1` always checks immediately to restore the previous behavior. --------- Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
committed by
GitHub
parent
d1ad8e1e80
commit
a9343896f4
@ -96,7 +96,7 @@ func NewPullRequest(ctx context.Context, opts *NewPullRequestOptions) error {
|
||||
}
|
||||
defer cancel()
|
||||
|
||||
if err := testPatch(ctx, prCtx, pr); err != nil {
|
||||
if err := testPullRequestTmpRepoBranchMergeable(ctx, prCtx, pr); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
@ -314,12 +314,12 @@ func ChangeTargetBranch(ctx context.Context, pr *issues_model.PullRequest, doer
|
||||
pr.BaseBranch = targetBranch
|
||||
|
||||
// Refresh patch
|
||||
if err := TestPatch(pr); err != nil {
|
||||
if err := testPullRequestBranchMergeable(pr); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// Update target branch, PR diff and status
|
||||
// This is the same as checkAndUpdateStatus in check service, but also updates base_branch
|
||||
// This is the same as markPullRequestAsMergeable in check service, but also updates base_branch
|
||||
if pr.Status == issues_model.PullRequestStatusChecking {
|
||||
pr.Status = issues_model.PullRequestStatusMergeable
|
||||
}
|
||||
@ -409,7 +409,7 @@ func AddTestPullRequestTask(opts TestPullRequestOptions) {
|
||||
continue
|
||||
}
|
||||
|
||||
AddToTaskQueue(ctx, pr)
|
||||
StartPullRequestCheckImmediately(ctx, pr)
|
||||
comment, err := CreatePushPullComment(ctx, opts.Doer, pr, opts.OldCommitID, opts.NewCommitID)
|
||||
if err == nil && comment != nil {
|
||||
notify_service.PullRequestPushCommits(ctx, opts.Doer, pr, comment)
|
||||
@ -502,7 +502,7 @@ func AddTestPullRequestTask(opts TestPullRequestOptions) {
|
||||
log.Error("UpdateCommitDivergence: %v", err)
|
||||
}
|
||||
}
|
||||
AddToTaskQueue(ctx, pr)
|
||||
StartPullRequestCheckDelayable(ctx, pr)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user