Commit 34f5f02a authored by Manoj M J's avatar Manoj M J

Use specialized worker to refresh authorizations on project transfer

With this change, we will be using a specialized
worker to refresh authorizations whenever a
project is transferred to a new namespace/group.

Changelog: performance
parent e3ee45a3
......@@ -154,7 +154,6 @@ module Projects
user_ids = @old_namespace.user_ids_for_project_authorizations |
@new_namespace.user_ids_for_project_authorizations
if Feature.enabled?(:specialized_worker_for_project_transfer_auth_recalculation)
AuthorizedProjectUpdate::ProjectRecalculateWorker.perform_async(project.id)
# Until we compare the inconsistency rates of the new specialized worker and
......@@ -164,9 +163,6 @@ module Projects
blocking: false,
priority: UserProjectAccessChangedService::LOW_PRIORITY
)
else
UserProjectAccessChangedService.new(user_ids).execute
end
end
def rollback_side_effects
......
---
name: specialized_worker_for_project_transfer_auth_recalculation
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/61967
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/334237
milestone: '14.1'
type: development
group: group::access
default_enabled: false
......@@ -478,11 +478,6 @@ RSpec.describe Projects::TransferService do
group.add_owner(user)
end
context 'when the feature flag `specialized_worker_for_project_transfer_auth_recalculation` is enabled' do
before do
stub_feature_flags(specialized_worker_for_project_transfer_auth_recalculation: true)
end
it 'calls AuthorizedProjectUpdate::ProjectRecalculateWorker to update project authorizations' do
expect(AuthorizedProjectUpdate::ProjectRecalculateWorker)
.to receive(:perform_async).with(project.id)
......@@ -510,29 +505,6 @@ RSpec.describe Projects::TransferService do
end
end
context 'when the feature flag `specialized_worker_for_project_transfer_auth_recalculation` is disabled' do
before do
stub_feature_flags(specialized_worker_for_project_transfer_auth_recalculation: false)
end
it 'calls UserProjectAccessChangedService to update project authorizations' do
user_ids = [user.id, member_of_old_group.id, member_of_new_group.id]
expect_next_instance_of(UserProjectAccessChangedService, user_ids) do |service|
expect(service).to receive(:execute)
end
execute_transfer
end
it 'refreshes the permissions of the members of the old and new namespace' do
expect { execute_transfer }
.to change { member_of_old_group.authorized_projects.include?(project) }.from(true).to(false)
.and change { member_of_new_group.authorized_projects.include?(project) }.from(false).to(true)
end
end
end
describe 'transferring a design repository' do
subject { described_class.new(project, user) }
......
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