Browse Source

更改:开始停止同步加一个参数以及webhook触发晚五秒

pull/347/head
yystopf 2 years ago
parent
commit
4cacc91130
1 changed files with 3 additions and 2 deletions
  1. +3
    -2
      app/controllers/api/v1/projects/sync_repositories_controller.rb

+ 3
- 2
app/controllers/api/v1/projects/sync_repositories_controller.rb View File

@@ -31,7 +31,7 @@ class Api::V1::Projects::SyncRepositoriesController < Api::V1::BaseController
# TouchSyncJob.perform_later(item)
# end
@sync_repository_branches.each do |item|
TouchSyncJob.perform_later(item)
TouchSyncJob.set(wait: 5.seconds).perform_later(item)
end
rescue Exception => e
uid_logger_error(e.message)
@@ -53,9 +53,10 @@ class Api::V1::Projects::SyncRepositoriesController < Api::V1::BaseController
end

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[: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]})
@sync_repository_branches.each do |branch|
branch_sync_direction = branch&.sync_repository&.sync_direction.to_i


Loading…
Cancel
Save