mirror of
https://github.com/go-gitea/gitea
synced 2025-07-06 10:37: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
@ -28,7 +28,7 @@ const (
|
||||
stagingBranch = "staging" // this is used for a working branch
|
||||
)
|
||||
|
||||
type prContext struct {
|
||||
type prTmpRepoContext struct {
|
||||
context.Context
|
||||
tmpBasePath string
|
||||
pr *issues_model.PullRequest
|
||||
@ -36,7 +36,7 @@ type prContext struct {
|
||||
errbuf *strings.Builder // any use should be preceded by a Reset and preferably after use
|
||||
}
|
||||
|
||||
func (ctx *prContext) RunOpts() *git.RunOpts {
|
||||
func (ctx *prTmpRepoContext) RunOpts() *git.RunOpts {
|
||||
ctx.outbuf.Reset()
|
||||
ctx.errbuf.Reset()
|
||||
return &git.RunOpts{
|
||||
@ -48,7 +48,7 @@ func (ctx *prContext) RunOpts() *git.RunOpts {
|
||||
|
||||
// createTemporaryRepoForPR creates a temporary repo with "base" for pr.BaseBranch and "tracking" for pr.HeadBranch
|
||||
// it also create a second base branch called "original_base"
|
||||
func createTemporaryRepoForPR(ctx context.Context, pr *issues_model.PullRequest) (prCtx *prContext, cancel context.CancelFunc, err error) {
|
||||
func createTemporaryRepoForPR(ctx context.Context, pr *issues_model.PullRequest) (prCtx *prTmpRepoContext, cancel context.CancelFunc, err error) {
|
||||
if err := pr.LoadHeadRepo(ctx); err != nil {
|
||||
log.Error("%-v LoadHeadRepo: %v", pr, err)
|
||||
return nil, nil, fmt.Errorf("%v LoadHeadRepo: %w", pr, err)
|
||||
@ -81,7 +81,7 @@ func createTemporaryRepoForPR(ctx context.Context, pr *issues_model.PullRequest)
|
||||
}
|
||||
cancel = cleanup
|
||||
|
||||
prCtx = &prContext{
|
||||
prCtx = &prTmpRepoContext{
|
||||
Context: ctx,
|
||||
tmpBasePath: tmpBasePath,
|
||||
pr: pr,
|
||||
|
Reference in New Issue
Block a user