change bugs

This commit is contained in:
sylor_huang@126.com 2020-07-10 17:20:13 +08:00
parent 65b03f7c71
commit e0d9bfab6d
2 changed files with 14 additions and 14 deletions

View File

@ -14,22 +14,20 @@ class SyncProjectsJob < ApplicationJob
"sync_params": sync_params
}
uri = URI.parse(url)
if api_host
http = Net::HTTP.new(uri.hostname, uri.port)
http.use_ssl = true
response = http.send_request('GET', uri.path, sync_params, {'Content-Type' => 'application/json'})
if response.status == 200
target_jsons = response.body
SyncLog.sync_log("=========target_jsons: #{target_jsons}============")
target_jsons = eval(target_jsons)
if sync_params[:type] == "Project"
update_new_project(target_jsons, sync_params[:new_project_id])
else
create_target(project, eval(target_jsons), sync_params[:type].to_s)
end
http = Net::HTTP.new(uri.hostname, uri.port)
http.use_ssl = true
response = http.send_request('GET', uri.path, sync_params, {'Content-Type' => 'application/json'})
if response.status == 200
target_jsons = response.body
SyncLog.sync_log("=========target_jsons: #{target_jsons}============")
target_jsons = eval(target_jsons)
if sync_params[:type] == "Project"
update_new_project(target_jsons, sync_params[:new_project_id])
else
SyncLog.sync_log("==========sync_project_to_forge_failed #{sync_params[:type]}============")
create_target(project, eval(target_jsons), sync_params[:type].to_s)
end
else
SyncLog.sync_log("==========sync_project_to_forge_failed #{sync_params[:type]}============")
end
rescue => e
SyncLog.sync_log("==========sync_project_to_forge_failed #{sync_params[:type]}============errors:#{e}")

View File

@ -6,6 +6,8 @@ class SyncRepositoryJob < ApplicationJob
def perform(repository, repository_params, gitea_main)
#创建临时文件夹 clone 并强推代码
SyncLog.sync_log("=================begin to sync request trustie repository=====================")
SyncLog.sync_log("=================begin to sync repository_params:==#{repository_params}===================")
SyncLog.sync_log("=================repository_url:==#{repository_params[:url]}===================")
path = "#{Rails.root}/public/cache_repository"
unless File.directory?(path)
FileUtils.mkdir_p(path)