change bugs

This commit is contained in:
sylor_huang@126.com 2020-07-10 09:53:13 +08:00
parent 804e971314
commit 4aec62fc33
3 changed files with 9 additions and 9 deletions

View File

@ -21,7 +21,7 @@ class SyncForgeController < ApplicationController
project = Projects::CreateService.new(project_user, project_params).call
if project.present?
ProjectScore.create!( sync_params[:project_score].merge(project_id: project.id)) if sync_params[:project_score]
SyncRepositoryJob.perform_later(project.repository, sync_params[:repository_params]) if sync_params[:repository_params]
SyncRepositoryJob.perform_later(project.repository, sync_params[:repository]) if sync_params[:repository]
check_new_project(project, sync_params)
end
end
@ -69,8 +69,8 @@ class SyncForgeController < ApplicationController
private
def check_sync_project(project,sync_params)
if sync_params[:repository_params].present? #仓库存在
change_project_score(project, sync_params[:project_score], sync_params[:repository_params]) #更新project_score
if sync_params[:repository].present? #仓库存在
change_project_score(project, sync_params[:project_score], sync_params[:repository]) #更新project_score
end
change_project_issues(project, sync_params[:issues],project.id)
change_project_members(project, sync_params[:members])

View File

@ -7,9 +7,9 @@ class SyncProjectsJob < ApplicationJob
def perform(sync_params)
SyncLog.sync_log.info("==========begin to sync #{sync_params[:type]} to forge============")
begin
gitea_main = "https://trustie.net"
if request.subdomain === 'testforgeplus'
gitea_main = "https://ucloudtest.trustie.net/"
gitea_main = "https://ucloudtest.trustie.net/"
if request.subdomain === 'forgeplus'
gitea_main = "https://trustie.net"
end
url = "#{gitea_main}/sync_forges" #trustie上的相关路由
@ -28,11 +28,11 @@ class SyncProjectsJob < ApplicationJob
create_target(eval(target_jsons), sync_params[:type].to_s)
end
else
SyncLog.sync_log.info("==========bsync_user_to_forge_failed #{sync_params[:type]}============")
SyncLog.sync_log.info("==========sync_project_to_forge_failed #{sync_params[:type]}============")
end
end
rescue => e
SyncLog.sync_log.info("==========bsync_user_to_forge_failed #{sync_params[:type]}============errors:#{e}")
SyncLog.sync_log.info("==========sync_project_to_forge_failed #{sync_params[:type]}============errors:#{e}")
end
end

View File

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