Implement sync push mirror on commit (#19411)

Support synchronizing with the push mirrors whenever new commits are pushed or synced from pull mirror.

Related Issues: #18220

Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: zeripath <art27@cantab.net>
Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
Chongyi Zheng 2022-07-08 15:45:12 -04:00 committed by GitHub
parent 496b8e3990
commit 49f9d43afe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 208 additions and 98 deletions

View file

@ -11,8 +11,8 @@ import (
repo_model "code.gitea.io/gitea/models/repo"
"code.gitea.io/gitea/models/unit"
"code.gitea.io/gitea/modules/context"
mirror_module "code.gitea.io/gitea/modules/mirror"
"code.gitea.io/gitea/modules/setting"
mirror_service "code.gitea.io/gitea/services/mirror"
)
// MirrorSync adds a mirrored repository to the sync queue
@ -59,7 +59,7 @@ func MirrorSync(ctx *context.APIContext) {
return
}
mirror_service.StartToMirror(repo.ID)
mirror_module.AddPullMirrorToQueue(repo.ID)
ctx.Status(http.StatusOK)
}