Commit 30bd0ab1 authored by Robert May's avatar Robert May Committed by Markus Koller

Log fork network unlinking

Provides a better trail of the exact steps performed when
unlinking a fork network
parent f78ebcbd
...@@ -9,6 +9,8 @@ module Projects ...@@ -9,6 +9,8 @@ module Projects
return unless fork_network return unless fork_network
log_info(message: "UnlinkForkService: Unlinking fork network", fork_network_id: fork_network.id)
merge_requests = fork_network merge_requests = fork_network
.merge_requests .merge_requests
.opened .opened
...@@ -16,6 +18,7 @@ module Projects ...@@ -16,6 +18,7 @@ module Projects
merge_requests.find_each do |mr| merge_requests.find_each do |mr|
::MergeRequests::CloseService.new(@project, @current_user).execute(mr) ::MergeRequests::CloseService.new(@project, @current_user).execute(mr)
log_info(message: "UnlinkForkService: Closed merge request", merge_request_id: mr.id)
end end
Project.transaction do Project.transaction do
...@@ -31,6 +34,16 @@ module Projects ...@@ -31,6 +34,16 @@ module Projects
end end
end end
# rubocop: disable Cop/InBatches
Project.uncached do
@project.forked_to_members.in_batches do |fork_relation|
fork_relation.pluck(:id).each do |fork_id| # rubocop: disable CodeReuse/ActiveRecord
log_info(message: "UnlinkForkService: Unlinked fork of root_project", project_id: @project.id, forked_project_id: fork_id)
end
end
end
# rubocop: enable Cop/InBatches
# When the project getting out of the network is a node with parent # When the project getting out of the network is a node with parent
# and children, both the parent and the node needs a cache refresh. # and children, both the parent and the node needs a cache refresh.
[forked_from, @project].compact.each do |project| [forked_from, @project].compact.each do |project|
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment