Commit bc01066c authored by Imre Farkas's avatar Imre Farkas

Merge branch 'mmj-remove-some-inline-jobs' into 'master'

Enqueue async, non-blocking project authorization refresh jobs for group-group share actions

See merge request gitlab-org/gitlab!66349
parents d8fe0094 dc475336
...@@ -24,7 +24,7 @@ module Groups ...@@ -24,7 +24,7 @@ module Groups
) )
if link.save if link.save
shared_with_group.refresh_members_authorized_projects(direct_members_only: true) shared_with_group.refresh_members_authorized_projects(blocking: false, direct_members_only: true)
success(link: link) success(link: link)
else else
error(link.errors.full_messages.to_sentence, 409) error(link.errors.full_messages.to_sentence, 409)
......
...@@ -16,7 +16,7 @@ module Groups ...@@ -16,7 +16,7 @@ module Groups
groups_to_refresh = links.map(&:shared_with_group) groups_to_refresh = links.map(&:shared_with_group)
groups_to_refresh.uniq.each do |group| groups_to_refresh.uniq.each do |group|
group.refresh_members_authorized_projects(direct_members_only: true) group.refresh_members_authorized_projects(blocking: false, direct_members_only: true)
end end
else else
Gitlab::AppLogger.info( Gitlab::AppLogger.info(
......
...@@ -13,7 +13,7 @@ module Groups ...@@ -13,7 +13,7 @@ module Groups
group_link.update!(group_link_params) group_link.update!(group_link_params)
if requires_authorization_refresh?(group_link_params) if requires_authorization_refresh?(group_link_params)
group_link.shared_with_group.refresh_members_authorized_projects(direct_members_only: true) group_link.shared_with_group.refresh_members_authorized_projects(blocking: false, direct_members_only: true)
end end
end end
......
...@@ -88,7 +88,7 @@ RSpec.describe Groups::GroupLinksController do ...@@ -88,7 +88,7 @@ RSpec.describe Groups::GroupLinksController do
end end
end end
it 'updates project permissions' do it 'updates project permissions', :sidekiq_inline do
expect { subject }.to change { group_member.can?(:read_project, project) }.from(false).to(true) expect { subject }.to change { group_member.can?(:read_project, project) }.from(false).to(true)
end end
...@@ -207,7 +207,7 @@ RSpec.describe Groups::GroupLinksController do ...@@ -207,7 +207,7 @@ RSpec.describe Groups::GroupLinksController do
end end
end end
it 'updates project permissions' do it 'updates project permissions', :sidekiq_inline do
expect { subject }.to change { group_member.can?(:create_release, project) }.from(true).to(false) expect { subject }.to change { group_member.can?(:create_release, project) }.from(true).to(false)
end end
end end
...@@ -244,7 +244,7 @@ RSpec.describe Groups::GroupLinksController do ...@@ -244,7 +244,7 @@ RSpec.describe Groups::GroupLinksController do
expect { subject }.to change(GroupGroupLink, :count).by(-1) expect { subject }.to change(GroupGroupLink, :count).by(-1)
end end
it 'updates project permissions' do it 'updates project permissions', :sidekiq_inline do
expect { subject }.to change { group_member.can?(:create_release, project) }.from(true).to(false) expect { subject }.to change { group_member.can?(:create_release, project) }.from(true).to(false)
end end
end end
......
...@@ -24,7 +24,7 @@ RSpec.describe Groups::GroupLinks::DestroyService, '#execute' do ...@@ -24,7 +24,7 @@ RSpec.describe Groups::GroupLinks::DestroyService, '#execute' do
expect { subject.execute(link) }.to change { shared_group.shared_with_group_links.count }.from(1).to(0) expect { subject.execute(link) }.to change { shared_group.shared_with_group_links.count }.from(1).to(0)
end end
it 'revokes project authorization' do it 'revokes project authorization', :sidekiq_inline do
group.add_developer(user) group.add_developer(user)
expect { subject.execute(link) }.to( expect { subject.execute(link) }.to(
...@@ -47,8 +47,8 @@ RSpec.describe Groups::GroupLinks::DestroyService, '#execute' do ...@@ -47,8 +47,8 @@ RSpec.describe Groups::GroupLinks::DestroyService, '#execute' do
it 'updates project authorization once per group' do it 'updates project authorization once per group' do
expect(GroupGroupLink).to receive(:delete).and_call_original expect(GroupGroupLink).to receive(:delete).and_call_original
expect(group).to receive(:refresh_members_authorized_projects).with(direct_members_only: true).once expect(group).to receive(:refresh_members_authorized_projects).with(direct_members_only: true, blocking: false).once
expect(another_group).to receive(:refresh_members_authorized_projects).with(direct_members_only: true).once expect(another_group).to receive(:refresh_members_authorized_projects).with(direct_members_only: true, blocking: false).once
subject.execute(links) subject.execute(links)
end end
......
...@@ -36,7 +36,7 @@ RSpec.describe Groups::GroupLinks::UpdateService, '#execute' do ...@@ -36,7 +36,7 @@ RSpec.describe Groups::GroupLinks::UpdateService, '#execute' do
expect(link.expires_at).to eq(expiry_date) expect(link.expires_at).to eq(expiry_date)
end end
it 'updates project permissions' do it 'updates project permissions', :sidekiq_inline do
expect { subject }.to change { group_member_user.can?(:create_release, project) }.from(true).to(false) expect { subject }.to change { group_member_user.can?(:create_release, project) }.from(true).to(false)
end end
......
...@@ -51,7 +51,7 @@ RSpec.describe RemoveExpiredGroupLinksWorker do ...@@ -51,7 +51,7 @@ RSpec.describe RemoveExpiredGroupLinksWorker do
subject.perform subject.perform
end end
it 'removes project authorization' do it 'removes project authorization', :sidekiq_inline do
shared_group = group_group_link.shared_group shared_group = group_group_link.shared_group
shared_with_group = group_group_link.shared_with_group shared_with_group = group_group_link.shared_with_group
project = create(:project, group: shared_group) project = create(:project, group: shared_group)
......
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