Commit 1229ce06 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Merge branch 'sh-async-delete-children' into 'master'

Make nested groups deletion synchronous to avoid potential race

See merge request !9288
parents dfd15596 334591dd
...@@ -18,7 +18,8 @@ module Groups ...@@ -18,7 +18,8 @@ module Groups
end end
group.children.each do |group| group.children.each do |group|
DestroyService.new(group, current_user).async_execute # This needs to be synchronous since the namespace gets destroyed below
DestroyService.new(group, current_user).execute
end end
group.really_destroy! group.really_destroy!
......
...@@ -5,6 +5,7 @@ describe Groups::DestroyService, services: true do ...@@ -5,6 +5,7 @@ describe Groups::DestroyService, services: true do
let!(:user) { create(:user) } let!(:user) { create(:user) }
let!(:group) { create(:group) } let!(:group) { create(:group) }
let!(:nested_group) { create(:group, parent: group) }
let!(:project) { create(:project, namespace: group) } let!(:project) { create(:project, namespace: group) }
let!(:gitlab_shell) { Gitlab::Shell.new } let!(:gitlab_shell) { Gitlab::Shell.new }
let!(:remove_path) { group.path + "+#{group.id}+deleted" } let!(:remove_path) { group.path + "+#{group.id}+deleted" }
...@@ -20,6 +21,7 @@ describe Groups::DestroyService, services: true do ...@@ -20,6 +21,7 @@ describe Groups::DestroyService, services: true do
end end
it { expect(Group.unscoped.all).not_to include(group) } it { expect(Group.unscoped.all).not_to include(group) }
it { expect(Group.unscoped.all).not_to include(nested_group) }
it { expect(Project.unscoped.all).not_to include(project) } it { expect(Project.unscoped.all).not_to include(project) }
end end
......
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