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
0
Merge Requests
0
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
Boxiang Sun
gitlab-ce
Commits
48776f27
Commit
48776f27
authored
Aug 21, 2017
by
Grzegorz Bizon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Simplify pipeline sidekiq queues naming scheme
parent
ce274fd6
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
10 deletions
+10
-10
app/workers/concerns/pipeline_queue.rb
app/workers/concerns/pipeline_queue.rb
+4
-4
app/workers/pipeline_update_worker.rb
app/workers/pipeline_update_worker.rb
+1
-1
config/sidekiq_queues.yml
config/sidekiq_queues.yml
+1
-1
spec/workers/concerns/pipeline_queue_spec.rb
spec/workers/concerns/pipeline_queue_spec.rb
+4
-4
No files found.
app/workers/concerns/pipeline_queue.rb
View file @
48776f27
...
@@ -5,14 +5,14 @@ module PipelineQueue
...
@@ -5,14 +5,14 @@ module PipelineQueue
extend
ActiveSupport
::
Concern
extend
ActiveSupport
::
Concern
included
do
included
do
sidekiq_options
queue:
'pipeline
s-
default'
sidekiq_options
queue:
'pipeline
_
default'
end
end
class_methods
do
class_methods
do
def
enqueue_in
(
queue
:,
group
:)
def
enqueue_in
(
group
:)
raise
ArgumentError
if
queue
.
empty?
||
group
.
empty?
raise
ArgumentError
,
'Unspecified queue group!'
if
group
.
empty?
sidekiq_options
queue:
"pipeline
s-
#{
queue
}
-
#{
group
}
"
sidekiq_options
queue:
"pipeline
_
#{
group
}
"
end
end
end
end
end
end
app/workers/pipeline_update_worker.rb
View file @
48776f27
...
@@ -2,7 +2,7 @@ class PipelineUpdateWorker
...
@@ -2,7 +2,7 @@ class PipelineUpdateWorker
include
Sidekiq
::
Worker
include
Sidekiq
::
Worker
include
PipelineQueue
include
PipelineQueue
enqueue_in
queue: :pipeline
,
group: :processing
enqueue_in
group: :processing
def
perform
(
pipeline_id
)
def
perform
(
pipeline_id
)
Ci
::
Pipeline
.
find_by
(
id:
pipeline_id
)
Ci
::
Pipeline
.
find_by
(
id:
pipeline_id
)
...
...
config/sidekiq_queues.yml
View file @
48776f27
...
@@ -27,7 +27,7 @@
...
@@ -27,7 +27,7 @@
- [new_merge_request, 2]
- [new_merge_request, 2]
- [build, 2]
- [build, 2]
- [pipeline, 2]
- [pipeline, 2]
- [pipeline
s-pipeline-
processing, 2]
- [pipeline
_
processing, 2]
- [gitlab_shell, 2]
- [gitlab_shell, 2]
- [email_receiver, 2]
- [email_receiver, 2]
- [emails_on_push, 2]
- [emails_on_push, 2]
...
...
spec/workers/concerns/pipeline_queue_spec.rb
View file @
48776f27
...
@@ -10,15 +10,15 @@ describe PipelineQueue do
...
@@ -10,15 +10,15 @@ describe PipelineQueue do
it
'sets a default pipelines queue automatically'
do
it
'sets a default pipelines queue automatically'
do
expect
(
worker
.
sidekiq_options
[
'queue'
])
expect
(
worker
.
sidekiq_options
[
'queue'
])
.
to
eq
'pipeline
s-
default'
.
to
eq
'pipeline
_
default'
end
end
describe
'.enqueue_in'
do
describe
'.enqueue_in'
do
it
'sets a custom sidekiq queue with prefix
, name
and group'
do
it
'sets a custom sidekiq queue with prefix and group'
do
worker
.
enqueue_in
(
queue: :build
,
group: :processing
)
worker
.
enqueue_in
(
group: :processing
)
expect
(
worker
.
sidekiq_options
[
'queue'
])
expect
(
worker
.
sidekiq_options
[
'queue'
])
.
to
eq
'pipeline
s-build-
processing'
.
to
eq
'pipeline
_
processing'
end
end
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