Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
652c1ee8
Commit
652c1ee8
authored
Jun 09, 2021
by
Manoj M J
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use specialized project_authorization workers
Changelog: performance
parent
b7634cfb
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
23 additions
and
95 deletions
+23
-95
app/services/projects/create_service.rb
app/services/projects/create_service.rb
+10
-14
app/services/projects/group_links/create_service.rb
app/services/projects/group_links/create_service.rb
+11
-15
config/feature_flags/development/specialized_project_authorization_project_share_worker.yml
...pecialized_project_authorization_project_share_worker.yml
+0
-8
config/feature_flags/development/specialized_project_authorization_workers.yml
...development/specialized_project_authorization_workers.yml
+0
-8
spec/services/projects/create_service_spec.rb
spec/services/projects/create_service_spec.rb
+1
-29
spec/services/projects/group_links/create_service_spec.rb
spec/services/projects/group_links/create_service_spec.rb
+1
-21
No files found.
app/services/projects/create_service.rb
View file @
652c1ee8
...
...
@@ -130,7 +130,6 @@ module Projects
access_level:
group_access_level
)
end
if
Feature
.
enabled?
(
:specialized_project_authorization_workers
,
default_enabled: :yaml
)
AuthorizedProjectUpdate
::
ProjectCreateWorker
.
perform_async
(
@project
.
id
)
# AuthorizedProjectsWorker uses an exclusive lease per user but
# specialized workers might have synchronization issues. Until we
...
...
@@ -141,9 +140,6 @@ module Projects
blocking:
false
,
priority:
UserProjectAccessChangedService
::
LOW_PRIORITY
)
else
@project
.
group
.
refresh_members_authorized_projects
(
blocking:
false
)
end
else
@project
.
add_maintainer
(
@project
.
namespace
.
owner
,
current_user:
current_user
)
end
...
...
app/services/projects/group_links/create_service.rb
View file @
652c1ee8
...
...
@@ -23,7 +23,6 @@ module Projects
private
def
setup_authorizations
(
group
,
group_access
=
nil
)
if
Feature
.
enabled?
(
:specialized_project_authorization_project_share_worker
,
default_enabled: :yaml
)
AuthorizedProjectUpdate
::
ProjectGroupLinkCreateWorker
.
perform_async
(
project
.
id
,
group
.
id
,
group_access
)
...
...
@@ -36,9 +35,6 @@ module Projects
blocking:
false
,
priority:
UserProjectAccessChangedService
::
LOW_PRIORITY
)
else
group
.
refresh_members_authorized_projects
(
blocking:
false
)
end
end
end
end
...
...
config/feature_flags/development/specialized_project_authorization_project_share_worker.yml
deleted
100644 → 0
View file @
b7634cfb
---
name
:
specialized_project_authorization_project_share_worker
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/32864
rollout_issue_url
:
milestone
:
'
13.2'
type
:
development
group
:
group::access
default_enabled
:
true
config/feature_flags/development/specialized_project_authorization_workers.yml
deleted
100644 → 0
View file @
b7634cfb
---
name
:
specialized_project_authorization_workers
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/31377
rollout_issue_url
:
milestone
:
'
13.0'
type
:
development
group
:
group::access
default_enabled
:
true
spec/services/projects/create_service_spec.rb
View file @
652c1ee8
...
...
@@ -806,7 +806,7 @@ RSpec.describe Projects::CreateService, '#execute' do
end
end
context
'with specialized
_project_authorization_
workers'
do
context
'with specialized
project_authorization
workers'
do
let_it_be
(
:other_user
)
{
create
(
:user
)
}
let_it_be
(
:group
)
{
create
(
:group
)
}
...
...
@@ -847,34 +847,6 @@ RSpec.describe Projects::CreateService, '#execute' do
create_project
(
user
,
opts
)
end
context
'when feature is disabled'
do
before
do
stub_feature_flags
(
specialized_project_authorization_workers:
false
)
end
it
'updates authorization for current_user'
do
project
=
create_project
(
user
,
opts
)
expect
(
Ability
.
allowed?
(
user
,
:read_project
,
project
)
).
to
be_truthy
end
it
'uses AuthorizedProjectsWorker'
do
expect
(
AuthorizedProjectsWorker
).
to
(
receive
(
:bulk_perform_async
).
with
(
array_including
([
user
.
id
],
[
other_user
.
id
])).
and_call_original
)
expect
(
AuthorizedProjectUpdate
::
ProjectCreateWorker
).
not_to
(
receive
(
:perform_async
)
)
expect
(
AuthorizedProjectUpdate
::
UserRefreshWithLowUrgencyWorker
).
not_to
(
receive
(
:bulk_perform_in
)
)
create_project
(
user
,
opts
)
end
end
end
def
create_project
(
user
,
opts
)
...
...
spec/services/projects/group_links/create_service_spec.rb
View file @
652c1ee8
...
...
@@ -38,7 +38,7 @@ RSpec.describe Projects::GroupLinks::CreateService, '#execute' do
expect
{
subject
.
execute
(
create
(
:group
))
}.
not_to
change
{
project
.
project_group_links
.
count
}
end
context
'with specialized
_project_authorization_
workers'
do
context
'with specialized
project_authorization
workers'
do
let_it_be
(
:other_user
)
{
create
(
:user
)
}
before
do
...
...
@@ -64,25 +64,5 @@ RSpec.describe Projects::GroupLinks::CreateService, '#execute' do
subject
.
execute
(
group
)
end
context
'when feature is disabled'
do
before
do
stub_feature_flags
(
specialized_project_authorization_project_share_worker:
false
)
end
it
'uses AuthorizedProjectsWorker'
do
expect
(
AuthorizedProjectsWorker
).
to
(
receive
(
:bulk_perform_async
).
with
(
array_including
([
user
.
id
],
[
other_user
.
id
])).
and_call_original
)
expect
(
AuthorizedProjectUpdate
::
ProjectCreateWorker
).
not_to
(
receive
(
:perform_async
)
)
expect
(
AuthorizedProjectUpdate
::
UserRefreshWithLowUrgencyWorker
).
not_to
(
receive
(
:bulk_perform_in
)
)
subject
.
execute
(
group
)
end
end
end
end
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment