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
f444387b
Commit
f444387b
authored
Jun 11, 2021
by
Manoj M J
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use a new worker in lieu of UserRefreshWithLowUrgencyWorker as safeguard
Changelog: other
parent
50b9d851
Changes
9
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
42 additions
and
6 deletions
+42
-6
app/services/user_project_access_changed_service.rb
app/services/user_project_access_changed_service.rb
+1
-1
app/workers/all_queues.yml
app/workers/all_queues.yml
+9
-0
app/workers/authorized_project_update/user_refresh_from_replica_worker.rb
...orized_project_update/user_refresh_from_replica_worker.rb
+15
-0
spec/services/projects/create_service_spec.rb
spec/services/projects/create_service_spec.rb
+1
-1
spec/services/projects/group_links/create_service_spec.rb
spec/services/projects/group_links/create_service_spec.rb
+1
-1
spec/services/projects/group_links/destroy_service_spec.rb
spec/services/projects/group_links/destroy_service_spec.rb
+2
-2
spec/services/user_project_access_changed_service_spec.rb
spec/services/user_project_access_changed_service_spec.rb
+1
-1
spec/workers/authorized_project_update/user_refresh_from_replica_worker_spec.rb
...d_project_update/user_refresh_from_replica_worker_spec.rb
+11
-0
spec/workers/every_sidekiq_worker_spec.rb
spec/workers/every_sidekiq_worker_spec.rb
+1
-0
No files found.
app/services/user_project_access_changed_service.rb
View file @
f444387b
...
@@ -20,7 +20,7 @@ class UserProjectAccessChangedService
...
@@ -20,7 +20,7 @@ class UserProjectAccessChangedService
if
priority
==
HIGH_PRIORITY
if
priority
==
HIGH_PRIORITY
AuthorizedProjectsWorker
.
bulk_perform_async
(
bulk_args
)
# rubocop:disable Scalability/BulkPerformWithContext
AuthorizedProjectsWorker
.
bulk_perform_async
(
bulk_args
)
# rubocop:disable Scalability/BulkPerformWithContext
else
else
AuthorizedProjectUpdate
::
UserRefresh
WithLowUrgency
Worker
.
bulk_perform_in
(
# rubocop:disable Scalability/BulkPerformWithContext
AuthorizedProjectUpdate
::
UserRefresh
FromReplica
Worker
.
bulk_perform_in
(
# rubocop:disable Scalability/BulkPerformWithContext
DELAY
,
bulk_args
,
batch_size:
100
,
batch_delay:
30
.
seconds
)
DELAY
,
bulk_args
,
batch_size:
100
,
batch_delay:
30
.
seconds
)
end
end
end
end
...
...
app/workers/all_queues.yml
View file @
f444387b
...
@@ -30,6 +30,15 @@
...
@@ -30,6 +30,15 @@
:weight:
1
:weight:
1
:idempotent:
true
:idempotent:
true
:tags: []
:tags: []
-
:name: authorized_project_update:authorized_project_update_user_refresh_from_replica
:worker_name: AuthorizedProjectUpdate::UserRefreshFromReplicaWorker
:feature_category: :authentication_and_authorization
:has_external_dependencies:
:urgency: :low
:resource_boundary: :unknown
:weight:
1
:idempotent:
true
:tags: []
-
:name: authorized_project_update:authorized_project_update_user_refresh_over_user_range
-
:name: authorized_project_update:authorized_project_update_user_refresh_over_user_range
:worker_name: AuthorizedProjectUpdate::UserRefreshOverUserRangeWorker
:worker_name: AuthorizedProjectUpdate::UserRefreshOverUserRangeWorker
:feature_category: :authentication_and_authorization
:feature_category: :authentication_and_authorization
...
...
app/workers/authorized_project_update/user_refresh_from_replica_worker.rb
0 → 100644
View file @
f444387b
# frozen_string_literal: true
module
AuthorizedProjectUpdate
class
UserRefreshFromReplicaWorker
<
::
AuthorizedProjectsWorker
feature_category
:authentication_and_authorization
urgency
:low
queue_namespace
:authorized_project_update
deduplicate
:until_executing
,
including_scheduled:
true
idempotent!
# This worker will start reading data from the replica database soon
# Issue: https://gitlab.com/gitlab-org/gitlab/-/issues/333219
end
end
spec/services/projects/create_service_spec.rb
View file @
f444387b
...
@@ -837,7 +837,7 @@ RSpec.describe Projects::CreateService, '#execute' do
...
@@ -837,7 +837,7 @@ RSpec.describe Projects::CreateService, '#execute' do
expect
(
AuthorizedProjectUpdate
::
ProjectCreateWorker
).
to
(
expect
(
AuthorizedProjectUpdate
::
ProjectCreateWorker
).
to
(
receive
(
:perform_async
).
and_call_original
receive
(
:perform_async
).
and_call_original
)
)
expect
(
AuthorizedProjectUpdate
::
UserRefresh
WithLowUrgency
Worker
).
to
(
expect
(
AuthorizedProjectUpdate
::
UserRefresh
FromReplica
Worker
).
to
(
receive
(
:bulk_perform_in
)
receive
(
:bulk_perform_in
)
.
with
(
1
.
hour
,
.
with
(
1
.
hour
,
array_including
([
user
.
id
],
[
other_user
.
id
]),
array_including
([
user
.
id
],
[
other_user
.
id
]),
...
...
spec/services/projects/group_links/create_service_spec.rb
View file @
f444387b
...
@@ -54,7 +54,7 @@ RSpec.describe Projects::GroupLinks::CreateService, '#execute' do
...
@@ -54,7 +54,7 @@ RSpec.describe Projects::GroupLinks::CreateService, '#execute' do
.
with
(
project
.
id
,
group
.
id
,
group_access
)
.
with
(
project
.
id
,
group
.
id
,
group_access
)
.
and_call_original
.
and_call_original
)
)
expect
(
AuthorizedProjectUpdate
::
UserRefresh
WithLowUrgency
Worker
).
to
(
expect
(
AuthorizedProjectUpdate
::
UserRefresh
FromReplica
Worker
).
to
(
receive
(
:bulk_perform_in
)
receive
(
:bulk_perform_in
)
.
with
(
1
.
hour
,
.
with
(
1
.
hour
,
array_including
([
user
.
id
],
[
other_user
.
id
]),
array_including
([
user
.
id
],
[
other_user
.
id
]),
...
...
spec/services/projects/group_links/destroy_service_spec.rb
View file @
f444387b
...
@@ -31,8 +31,8 @@ RSpec.describe Projects::GroupLinks::DestroyService, '#execute' do
...
@@ -31,8 +31,8 @@ RSpec.describe Projects::GroupLinks::DestroyService, '#execute' do
subject
.
execute
(
group_link
)
subject
.
execute
(
group_link
)
end
end
it
'calls AuthorizedProjectUpdate::UserRefresh
WithLowUrgency
Worker with a delay to update project authorizations'
do
it
'calls AuthorizedProjectUpdate::UserRefresh
FromReplica
Worker with a delay to update project authorizations'
do
expect
(
AuthorizedProjectUpdate
::
UserRefresh
WithLowUrgency
Worker
).
to
(
expect
(
AuthorizedProjectUpdate
::
UserRefresh
FromReplica
Worker
).
to
(
receive
(
:bulk_perform_in
)
receive
(
:bulk_perform_in
)
.
with
(
1
.
hour
,
.
with
(
1
.
hour
,
[[
user
.
id
]],
[[
user
.
id
]],
...
...
spec/services/user_project_access_changed_service_spec.rb
View file @
f444387b
...
@@ -19,7 +19,7 @@ RSpec.describe UserProjectAccessChangedService do
...
@@ -19,7 +19,7 @@ RSpec.describe UserProjectAccessChangedService do
end
end
it
'permits low-priority operation'
do
it
'permits low-priority operation'
do
expect
(
AuthorizedProjectUpdate
::
UserRefresh
WithLowUrgency
Worker
).
to
(
expect
(
AuthorizedProjectUpdate
::
UserRefresh
FromReplica
Worker
).
to
(
receive
(
:bulk_perform_in
).
with
(
receive
(
:bulk_perform_in
).
with
(
described_class
::
DELAY
,
described_class
::
DELAY
,
[[
1
],
[
2
]],
[[
1
],
[
2
]],
...
...
spec/workers/authorized_project_update/user_refresh_from_replica_worker_spec.rb
0 → 100644
View file @
f444387b
# frozen_string_literal: true
require
'spec_helper'
RSpec
.
describe
AuthorizedProjectUpdate
::
UserRefreshFromReplicaWorker
do
it
'is labeled as low urgency'
do
expect
(
described_class
.
get_urgency
).
to
eq
(
:low
)
end
it_behaves_like
"refreshes user's project authorizations"
end
spec/workers/every_sidekiq_worker_spec.rb
View file @
f444387b
...
@@ -130,6 +130,7 @@ RSpec.describe 'Every Sidekiq worker' do
...
@@ -130,6 +130,7 @@ RSpec.describe 'Every Sidekiq worker' do
'AuthorizedProjectUpdate::ProjectGroupLinkCreateWorker'
=>
3
,
'AuthorizedProjectUpdate::ProjectGroupLinkCreateWorker'
=>
3
,
'AuthorizedProjectUpdate::UserRefreshOverUserRangeWorker'
=>
3
,
'AuthorizedProjectUpdate::UserRefreshOverUserRangeWorker'
=>
3
,
'AuthorizedProjectUpdate::UserRefreshWithLowUrgencyWorker'
=>
3
,
'AuthorizedProjectUpdate::UserRefreshWithLowUrgencyWorker'
=>
3
,
'AuthorizedProjectUpdate::UserRefreshFromReplicaWorker'
=>
3
,
'AuthorizedProjectsWorker'
=>
3
,
'AuthorizedProjectsWorker'
=>
3
,
'AutoDevops::DisableWorker'
=>
3
,
'AutoDevops::DisableWorker'
=>
3
,
'AutoMergeProcessWorker'
=>
3
,
'AutoMergeProcessWorker'
=>
3
,
...
...
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