Commit d347c606 authored by Imre Farkas's avatar Imre Farkas

Merge branch 'mmj-use-project-recalculate-worker-for-project-group-link-create' into 'master'

Use ProjectRecalculateWorker to refresh authorizations for Project-Group link create endpoints

See merge request gitlab-org/gitlab!65707
parents 715fc55a 3a3fb059
...@@ -13,7 +13,7 @@ module Projects ...@@ -13,7 +13,7 @@ module Projects
) )
if link.save if link.save
setup_authorizations(group, link.group_access) setup_authorizations(group)
success(link: link) success(link: link)
else else
error(link.errors.full_messages.to_sentence, 409) error(link.errors.full_messages.to_sentence, 409)
...@@ -22,9 +22,8 @@ module Projects ...@@ -22,9 +22,8 @@ module Projects
private private
def setup_authorizations(group, group_access = nil) def setup_authorizations(group)
AuthorizedProjectUpdate::ProjectGroupLinkCreateWorker.perform_async( AuthorizedProjectUpdate::ProjectRecalculateWorker.perform_async(project.id)
project.id, group.id, group_access)
# AuthorizedProjectsWorker uses an exclusive lease per user but # AuthorizedProjectsWorker uses an exclusive lease per user but
# specialized workers might have synchronization issues. Until we # specialized workers might have synchronization issues. Until we
......
...@@ -50,9 +50,9 @@ RSpec.describe Projects::GroupLinks::CreateService, '#execute' do ...@@ -50,9 +50,9 @@ RSpec.describe Projects::GroupLinks::CreateService, '#execute' do
expect(AuthorizedProjectsWorker).not_to( expect(AuthorizedProjectsWorker).not_to(
receive(:bulk_perform_async) receive(:bulk_perform_async)
) )
expect(AuthorizedProjectUpdate::ProjectGroupLinkCreateWorker).to( expect(AuthorizedProjectUpdate::ProjectRecalculateWorker).to(
receive(:perform_async) receive(:perform_async)
.with(project.id, group.id, group_access) .with(project.id)
.and_call_original .and_call_original
) )
expect(AuthorizedProjectUpdate::UserRefreshFromReplicaWorker).to( expect(AuthorizedProjectUpdate::UserRefreshFromReplicaWorker).to(
......
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