diff options
author | Nick Thomas <nick@gitlab.com> | 2017-08-23 17:28:16 +0300 |
---|---|---|
committer | Nick Thomas <nick@gitlab.com> | 2017-08-25 18:19:32 +0300 |
commit | 8b73df0cf534797bff9ce0f5b95af5347ea59ca6 (patch) | |
tree | 9dea336cc8619391dbdf6c904a3f72e873c37090 /spec/services/user_project_access_changed_service_spec.rb | |
parent | 24244d03b55bc7732b3362bab1e1cc7e04c2dabf (diff) |
Move sidekiq-based project authorization refresh out of Projects::CreateService
If the project is in a group, the `group.refresh_members_authorized_projects`
is made non-blocking, and we call `current_user.refresh_authorized_projects`
directly.
Projects in a personal namespace are more difficult. Rather than passing the
`blocking:` parameter through the entire `add_master` chain, have the
`AuthorizedProjectsWorker` automatically inline authorizations for three IDs or
less. Since the maximum number of IDs in this path is 2, that has the same effect.
Diffstat (limited to 'spec/services/user_project_access_changed_service_spec.rb')
-rw-r--r-- | spec/services/user_project_access_changed_service_spec.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/spec/services/user_project_access_changed_service_spec.rb b/spec/services/user_project_access_changed_service_spec.rb index 14a5e40350a..87a90378e2b 100644 --- a/spec/services/user_project_access_changed_service_spec.rb +++ b/spec/services/user_project_access_changed_service_spec.rb @@ -8,5 +8,12 @@ describe UserProjectAccessChangedService do described_class.new([1, 2]).execute end + + it 'permits non-blocking operation' do + expect(AuthorizedProjectsWorker).to receive(:bulk_perform_async) + .with([[1], [2]]) + + described_class.new([1, 2]).execute(blocking: false) + end end end |