Commit 0a82b838 authored by Manoj M J's avatar Manoj M J

Use specialized worker to refresh authorizations on group-share removal

With this change, we will be using a specialized
worker to refresh authorizations whenever a
project-group share is removed.

Changelog: performance
parent 05c5fc38
......@@ -13,7 +13,6 @@ module Projects
end
group_link.destroy.tap do |link|
if Feature.enabled?(:use_specialized_worker_for_project_auth_recalculation)
refresh_project_authorizations_asynchronously(link.project)
# Until we compare the inconsistency rates of the new specialized worker and
......@@ -23,9 +22,6 @@ module Projects
blocking: false,
priority: UserProjectAccessChangedService::LOW_PRIORITY
)
else
link.group.refresh_members_authorized_projects
end
end
end
......
---
name: use_specialized_worker_for_project_auth_recalculation
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/60904
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/331073
milestone: '14.0'
type: development
group: group::access
default_enabled: false
......@@ -20,11 +20,6 @@ RSpec.describe Projects::GroupLinks::DestroyService, '#execute' do
group.add_maintainer(user)
end
context 'when the feature flag `use_specialized_worker_for_project_auth_recalculation` is enabled' do
before do
stub_feature_flags(use_specialized_worker_for_project_auth_recalculation: true)
end
it 'calls AuthorizedProjectUpdate::ProjectRecalculateWorker to update project authorizations' do
expect(AuthorizedProjectUpdate::ProjectRecalculateWorker)
.to receive(:perform_async).with(group_link.project.id)
......@@ -50,27 +45,6 @@ RSpec.describe Projects::GroupLinks::DestroyService, '#execute' do
end
end
context 'when the feature flag `use_specialized_worker_for_project_auth_recalculation` is disabled' do
before do
stub_feature_flags(use_specialized_worker_for_project_auth_recalculation: false)
end
it 'calls UserProjectAccessChangedService to update project authorizations' do
expect_next_instance_of(UserProjectAccessChangedService, [user.id]) do |service|
expect(service).to receive(:execute)
end
subject.execute(group_link)
end
it 'updates project authorizations of users who had access to the project via the group share' do
expect { subject.execute(group_link) }.to(
change { Ability.allowed?(user, :read_project, project) }
.from(true).to(false))
end
end
end
it 'returns false if group_link is blank' do
expect { subject.execute(nil) }.not_to change { project.project_group_links.count }
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