From eec28fa054dd2486bbc17c705d4307aae1abee05 Mon Sep 17 00:00:00 2001 From: "sylor_huang@126.com" Date: Wed, 13 May 2020 14:19:14 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9B=E5=BB=BA=E9=A1=B9=E7=9B=AE=E4=B8=8A?= =?UTF-8?q?=E9=93=BE=E5=90=8E=E7=9A=84=E6=93=8D=E4=BD=9C=E5=B7=B2=E5=AE=8C?= =?UTF-8?q?=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/jobs/project_create_chain_job.rb | 23 ++++++--------------- app/services/repositories/create_service.rb | 2 -- 2 files changed, 6 insertions(+), 19 deletions(-) diff --git a/app/jobs/project_create_chain_job.rb b/app/jobs/project_create_chain_job.rb index 6d9d837f7..5d53ea841 100644 --- a/app/jobs/project_create_chain_job.rb +++ b/app/jobs/project_create_chain_job.rb @@ -2,35 +2,26 @@ class ProjectCreateChainJob < ApplicationJob queue_as :default def perform(chain_params) - Rails.logger.info("########_response_chain_params_22222_#{chain_params}__") - status = 0 + status = false chain_type = chain_params[:type].to_s reponame = chain_params[:reponame] - - Rails.logger.info("########_response_chain_chain_type_#{chain_type}__") - Rails.logger.info("########_response_reponame_#{reponame}__") 5.times do |i| - if status == 200 + if status Rails.logger.info("########_repository__#{reponame}______create_chain_success__try:_#{i+1}_") break else Rails.logger.info("########_repository__#{reponame}______start_to_create_chain__try:_#{i+1}_") if chain_type == "create" - chain_status = create_chain(chain_params) + status = create_chain(chain_params) elsif chain_type == "push" - chain_status = push_chain(chain_params) - else - chain_status = {status: 200} + status = push_chain(chain_params) end - Rails.logger.info("########_response__chain_status__#{chain_status}__") - - status = chain_status[:status].to_i end end - unless status == 200 - Rails.logger.info("########_repository__#{reponame}__create_chain:___#{chain_status}____failed_to_create_chain__") + unless status + Rails.logger.info("########_repository__#{reponame}__create_chain:___#{status}____failed_to_create_chain__") end end @@ -38,8 +29,6 @@ class ProjectCreateChainJob < ApplicationJob #创建项目的上链操作 def create_chain(chain_params) - Rails.logger.info("########_chain trustieCreate___#{chain_params[:ownername]}____#{chain_params[:reponame]}___") - system("chain trustieCreate #{chain_params[:ownername]} #{chain_params[:reponame]}") end diff --git a/app/services/repositories/create_service.rb b/app/services/repositories/create_service.rb index e206acd4e..5d9feda92 100644 --- a/app/services/repositories/create_service.rb +++ b/app/services/repositories/create_service.rb @@ -31,8 +31,6 @@ class Repositories::CreateService < ApplicationService ownername: user.try(:login), reponame: @repository.try(:id) } - Rails.logger.info("########_response_chain_params_111111_#{chain_params}__") - ProjectCreateChainJob.perform_later(chain_params) #创建上链操作 #暂时gitea的hook功能未完善 #Gitea::Repository::Hooks::CreateService.new(user, @repository.try(:identifier), hook_params).call #创建gitea的hook功能