更改:回滚+debug
This commit is contained in:
parent
626fa8a7b3
commit
aa739a25b6
|
@ -312,30 +312,30 @@ class ProjectsController < ApplicationController
|
|||
@project&.repository&.mirror&.succeeded!
|
||||
project_id = @project&.id
|
||||
user_id = @project&.owner&.id
|
||||
puts "############ mirror project_id,user_id: #{project_id},#{user_id} ############"
|
||||
Rails.logger.info "############ mirror project_id,user_id: #{project_id},#{user_id} ############"
|
||||
OpenProjectDevOpsJob.set(wait: 5.seconds).perform_later(project_id, user_id) if project_id.present? && user_id.present?
|
||||
UpdateProjectTopicJob.set(wait: 1.seconds).perform_later(project_id) if project_id.present?
|
||||
puts "############ mirror status: #{repo.mirror.status} ############"
|
||||
Rails.logger.info "############ mirror status: #{@project&.repository&.mirror&.status} ############"
|
||||
end
|
||||
elsif !@project.common? && @project&.repository&.mirror&.failed?
|
||||
Rails.logger.info "############ mirror status: #{@project&.repository&.mirror&.status}"
|
||||
Gitea::Repository::DeleteService.new(@project.owner, @project.identifier,current_user.gitea_token).call
|
||||
@project.destroy!
|
||||
@project.forked_projects.update_all(forked_from_project_id: nil)
|
||||
# 如果该项目有所属的项目分类以及为私有项目,需要更新对应数量
|
||||
@project.project_category.decrement!(:private_projects_count, 1) if @project.project_category.present? && !@project.is_public
|
||||
tip_exception("导入失败,请重试!")
|
||||
else
|
||||
# 为了缓存活跃项目的基本信息,后续删除
|
||||
Cache::V2::ProjectCommonService.new(@project.id).read
|
||||
# 项目名称,标识,所有者变化时重置缓存
|
||||
project_common = $redis_cache.hgetall("v2-project-common:#{@project.id}")
|
||||
if project_common.present?
|
||||
if project_common["name"] != @project.name || project_common["identifier"] != @project.identifier || project_common["owner_id"] != @project.user_id
|
||||
Cache::V2::ProjectCommonService.new(@project.id).reset
|
||||
end
|
||||
end
|
||||
json_response(@project, current_user)
|
||||
end
|
||||
# 为了缓存活跃项目的基本信息,后续删除
|
||||
Cache::V2::ProjectCommonService.new(@project.id).read
|
||||
# 项目名称,标识,所有者变化时重置缓存
|
||||
project_common = $redis_cache.hgetall("v2-project-common:#{@project.id}")
|
||||
if project_common.present?
|
||||
if project_common["name"] != @project.name || project_common["identifier"] != @project.identifier || project_common["owner_id"] != @project.user_id
|
||||
Cache::V2::ProjectCommonService.new(@project.id).reset
|
||||
end
|
||||
end
|
||||
json_response(@project, current_user)
|
||||
end
|
||||
|
||||
def recommend
|
||||
|
|
Loading…
Reference in New Issue