更改:开始停止同步加一个参数以及webhook触发晚五秒
This commit is contained in:
parent
db40a21b04
commit
4cacc91130
|
@ -31,7 +31,7 @@ class Api::V1::Projects::SyncRepositoriesController < Api::V1::BaseController
|
||||||
# TouchSyncJob.perform_later(item)
|
# TouchSyncJob.perform_later(item)
|
||||||
# end
|
# end
|
||||||
@sync_repository_branches.each do |item|
|
@sync_repository_branches.each do |item|
|
||||||
TouchSyncJob.perform_later(item)
|
TouchSyncJob.set(wait: 5.seconds).perform_later(item)
|
||||||
end
|
end
|
||||||
rescue Exception => e
|
rescue Exception => e
|
||||||
uid_logger_error(e.message)
|
uid_logger_error(e.message)
|
||||||
|
@ -53,9 +53,10 @@ class Api::V1::Projects::SyncRepositoriesController < Api::V1::BaseController
|
||||||
end
|
end
|
||||||
|
|
||||||
def change_enable
|
def change_enable
|
||||||
|
return render_error("请输入正确的仓库类型") if params[:repo_type].blank?
|
||||||
return render_error("请输入正确的分支名称") if params[:gitlink_branch_name].blank? || params[:external_branch_name].blank?
|
return render_error("请输入正确的分支名称") if params[:gitlink_branch_name].blank? || params[:external_branch_name].blank?
|
||||||
# return render_error("请输入正确的状态") if params[:enable].blank?
|
# return render_error("请输入正确的状态") if params[:enable].blank?
|
||||||
@sync_repository_branches = SyncRepositoryBranch.joins(:sync_repository).where(sync_repositories: {project_id: @project.id}, gitlink_branch_name: params[:gitlink_branch_name], external_branch_name: params[:external_branch_name])
|
@sync_repository_branches = SyncRepositoryBranch.joins(:sync_repository).where(sync_repositories: {project_id: @project.id, type: params[:repo_type]}, gitlink_branch_name: params[:gitlink_branch_name], external_branch_name: params[:external_branch_name])
|
||||||
if @sync_repository_branches.update_all({enable: params[:enable]})
|
if @sync_repository_branches.update_all({enable: params[:enable]})
|
||||||
@sync_repository_branches.each do |branch|
|
@sync_repository_branches.each do |branch|
|
||||||
branch_sync_direction = branch&.sync_repository&.sync_direction.to_i
|
branch_sync_direction = branch&.sync_repository&.sync_direction.to_i
|
||||||
|
|
Loading…
Reference in New Issue