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
c02855f4
Commit
c02855f4
authored
Nov 19, 2018
by
Rubén Dávila
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Backport of gitlab-ee!8470
parent
624ec622
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
7 deletions
+14
-7
app/workers/all_queues.yml
app/workers/all_queues.yml
+1
-1
doc/development/sidekiq_style_guide.md
doc/development/sidekiq_style_guide.md
+2
-2
lib/gitlab/sidekiq_config.rb
lib/gitlab/sidekiq_config.rb
+8
-1
spec/workers/every_sidekiq_worker_spec.rb
spec/workers/every_sidekiq_worker_spec.rb
+3
-3
No files found.
app/workers/all_queues.yml
View file @
c02855f4
...
@@ -81,9 +81,9 @@
...
@@ -81,9 +81,9 @@
-
todos_destroyer:todos_destroyer_confidential_issue
-
todos_destroyer:todos_destroyer_confidential_issue
-
todos_destroyer:todos_destroyer_entity_leave
-
todos_destroyer:todos_destroyer_entity_leave
-
todos_destroyer:todos_destroyer_group_private
-
todos_destroyer:todos_destroyer_project_private
-
todos_destroyer:todos_destroyer_project_private
-
todos_destroyer:todos_destroyer_private_features
-
todos_destroyer:todos_destroyer_private_features
-
todos_destroyer:todos_destroyer_group_private
-
default
-
default
-
mailers
# ActionMailer::DeliveryJob.queue_name
-
mailers
# ActionMailer::DeliveryJob.queue_name
...
...
doc/development/sidekiq_style_guide.md
View file @
c02855f4
...
@@ -17,8 +17,8 @@ would be `process_something`. If you're not sure what queue a worker uses,
...
@@ -17,8 +17,8 @@ would be `process_something`. If you're not sure what queue a worker uses,
you can find it using
`SomeWorker.queue`
. There is almost never a reason to
you can find it using
`SomeWorker.queue`
. There is almost never a reason to
manually override the queue name using
`sidekiq_options queue: :some_queue`
.
manually override the queue name using
`sidekiq_options queue: :some_queue`
.
You must always add any new queues to
`app/workers/all_queues.yml`
o
therwise
You must always add any new queues to
`app/workers/all_queues.yml`
o
r
`ee/app/workers/all_queues.yml`
your worker will not run.
otherwise
your worker will not run.
## Queue Namespaces
## Queue Namespaces
...
...
lib/gitlab/sidekiq_config.rb
View file @
c02855f4
...
@@ -5,11 +5,18 @@ require 'set'
...
@@ -5,11 +5,18 @@ require 'set'
module
Gitlab
module
Gitlab
module
SidekiqConfig
module
SidekiqConfig
QUEUE_CONFIG_PATHS
=
%w[app/workers/all_queues.yml ee/app/workers/all_queues.yml]
.
freeze
# This method is called by `bin/sidekiq-cluster` in EE, which runs outside
# This method is called by `bin/sidekiq-cluster` in EE, which runs outside
# of bundler/Rails context, so we cannot use any gem or Rails methods.
# of bundler/Rails context, so we cannot use any gem or Rails methods.
def
self
.
worker_queues
(
rails_path
=
Rails
.
root
.
to_s
)
def
self
.
worker_queues
(
rails_path
=
Rails
.
root
.
to_s
)
@worker_queues
||=
{}
@worker_queues
||=
{}
@worker_queues
[
rails_path
]
||=
YAML
.
load_file
(
File
.
join
(
rails_path
,
'app/workers/all_queues.yml'
))
@worker_queues
[
rails_path
]
||=
QUEUE_CONFIG_PATHS
.
flat_map
do
|
path
|
full_path
=
File
.
join
(
rails_path
,
path
)
File
.
exist?
(
full_path
)
?
YAML
.
load_file
(
full_path
)
:
[]
end
end
end
# This method is called by `bin/sidekiq-cluster` in EE, which runs outside
# This method is called by `bin/sidekiq-cluster` in EE, which runs outside
...
...
spec/workers/every_sidekiq_worker_spec.rb
View file @
c02855f4
...
@@ -9,7 +9,7 @@ describe 'Every Sidekiq worker' do
...
@@ -9,7 +9,7 @@ describe 'Every Sidekiq worker' do
expect
(
Gitlab
::
SidekiqConfig
.
cron_workers
.
map
(
&
:queue
)).
to
all
(
start_with
(
'cronjob:'
))
expect
(
Gitlab
::
SidekiqConfig
.
cron_workers
.
map
(
&
:queue
)).
to
all
(
start_with
(
'cronjob:'
))
end
end
it
'has its queue in
app/workers/all_queues.yml
'
,
:aggregate_failures
do
it
'has its queue in
Gitlab::SidekiqConfig::QUEUE_CONFIG_PATHS
'
,
:aggregate_failures
do
file_worker_queues
=
Gitlab
::
SidekiqConfig
.
worker_queues
.
to_set
file_worker_queues
=
Gitlab
::
SidekiqConfig
.
worker_queues
.
to_set
worker_queues
=
Gitlab
::
SidekiqConfig
.
workers
.
map
(
&
:queue
).
to_set
worker_queues
=
Gitlab
::
SidekiqConfig
.
workers
.
map
(
&
:queue
).
to_set
...
@@ -17,10 +17,10 @@ describe 'Every Sidekiq worker' do
...
@@ -17,10 +17,10 @@ describe 'Every Sidekiq worker' do
worker_queues
<<
'default'
worker_queues
<<
'default'
missing_from_file
=
worker_queues
-
file_worker_queues
missing_from_file
=
worker_queues
-
file_worker_queues
expect
(
missing_from_file
).
to
be_empty
,
"expected
#{
missing_from_file
.
to_a
.
inspect
}
to be in
app/workers/all_queues.yml
"
expect
(
missing_from_file
).
to
be_empty
,
"expected
#{
missing_from_file
.
to_a
.
inspect
}
to be in
Gitlab::SidekiqConfig::QUEUE_CONFIG_PATHS
"
unncessarily_in_file
=
file_worker_queues
-
worker_queues
unncessarily_in_file
=
file_worker_queues
-
worker_queues
expect
(
unncessarily_in_file
).
to
be_empty
,
"expected
#{
unncessarily_in_file
.
to_a
.
inspect
}
not to be in
app/workers/all_queues.yml
"
expect
(
unncessarily_in_file
).
to
be_empty
,
"expected
#{
unncessarily_in_file
.
to_a
.
inspect
}
not to be in
Gitlab::SidekiqConfig::QUEUE_CONFIG_PATHS
"
end
end
it
'has its queue or namespace in config/sidekiq_queues.yml'
,
:aggregate_failures
do
it
'has its queue or namespace in config/sidekiq_queues.yml'
,
:aggregate_failures
do
...
...
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