Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
heptapod
heptapod
Commits
5667a9365a7f
Commit
48776f27
authored
Aug 21, 2017
by
Grzegorz Bizon
Browse files
Simplify pipeline sidekiq queues naming scheme
parent
4e081f803c98
Changes
4
Hide whitespace changes
Inline
Side-by-side
app/workers/concerns/pipeline_queue.rb
View file @
5667a936
...
...
@@ -5,14 +5,14 @@ module PipelineQueue
extend
ActiveSupport
::
Concern
included
do
sidekiq_options
queue:
'pipeline
s-
default'
sidekiq_options
queue:
'pipeline
_
default'
end
class_methods
do
def
enqueue_in
(
queue
:,
group
:)
raise
ArgumentError
if
queue
.
empty?
||
group
.
empty?
def
enqueue_in
(
group
:)
raise
ArgumentError
,
'Unspecified queue group!'
if
group
.
empty?
sidekiq_options
queue:
"pipeline
s-
#{
queue
}
-
#{
group
}
"
sidekiq_options
queue:
"pipeline
_
#{
group
}
"
end
end
end
app/workers/pipeline_update_worker.rb
View file @
5667a936
...
...
@@ -2,7 +2,7 @@ class PipelineUpdateWorker
include
Sidekiq
::
Worker
include
PipelineQueue
enqueue_in
queue: :pipeline
,
group: :processing
enqueue_in
group: :processing
def
perform
(
pipeline_id
)
Ci
::
Pipeline
.
find_by
(
id:
pipeline_id
)
...
...
config/sidekiq_queues.yml
View file @
5667a936
...
...
@@ -27,7 +27,7 @@
- [new_merge_request, 2]
- [build, 2]
- [pipeline, 2]
- [pipeline
s-pipeline-
processing, 2]
- [pipeline
_
processing, 2]
- [gitlab_shell, 2]
- [email_receiver, 2]
- [emails_on_push, 2]
...
...
spec/workers/concerns/pipeline_queue_spec.rb
View file @
5667a936
...
...
@@ -10,15 +10,15 @@
it
'sets a default pipelines queue automatically'
do
expect
(
worker
.
sidekiq_options
[
'queue'
])
.
to
eq
'pipeline
s-
default'
.
to
eq
'pipeline
_
default'
end
describe
'.enqueue_in'
do
it
'sets a custom sidekiq queue with prefix
, name
and group'
do
worker
.
enqueue_in
(
queue: :build
,
group: :processing
)
it
'sets a custom sidekiq queue with prefix and group'
do
worker
.
enqueue_in
(
group: :processing
)
expect
(
worker
.
sidekiq_options
[
'queue'
])
.
to
eq
'pipeline
s-build-
processing'
.
to
eq
'pipeline
_
processing'
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