Move all push update operations to a queue (#10133)

* Fix test

* Add no queue for test only

* improve code

* Auto watch whatever branch operation

* Fix lint

* Rename noqueue to immediate

* Remove old PushUpdate function

* Fix tests

Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: techknowlogick <techknowlogick@gitea.io>
This commit is contained in:
Lunny Xiao 2020-09-11 22:14:48 +08:00 committed by GitHub
parent 910947fbcd
commit dd1a651b58
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 552 additions and 585 deletions

View file

@ -19,6 +19,7 @@ import (
repo_module "code.gitea.io/gitea/modules/repository"
"code.gitea.io/gitea/modules/util"
"code.gitea.io/gitea/routers/utils"
repo_service "code.gitea.io/gitea/services/repository"
)
const (
@ -118,10 +119,8 @@ func RestoreBranchPost(ctx *context.Context) {
}
// Don't return error below this
if err := repofiles.PushUpdate(
ctx.Repo.Repository,
deletedBranch.Name,
repofiles.PushUpdateOptions{
if err := repo_service.PushUpdate(
&repo_service.PushUpdateOptions{
RefFullName: git.BranchPrefix + deletedBranch.Name,
OldCommitID: git.EmptySHA,
NewCommitID: deletedBranch.Commit,
@ -157,10 +156,8 @@ func deleteBranch(ctx *context.Context, branchName string) error {
}
// Don't return error below this
if err := repofiles.PushUpdate(
ctx.Repo.Repository,
branchName,
repofiles.PushUpdateOptions{
if err := repo_service.PushUpdate(
&repo_service.PushUpdateOptions{
RefFullName: git.BranchPrefix + branchName,
OldCommitID: commit.ID.String(),
NewCommitID: git.EmptySHA,