Commit 48776f27 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Simplify pipeline sidekiq queues naming scheme

parent ce274fd6
...@@ -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: 'pipelines-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: "pipelines-#{queue}-#{group}" sidekiq_options queue: "pipeline_#{group}"
end end
end end
end end
...@@ -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)
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
- [new_merge_request, 2] - [new_merge_request, 2]
- [build, 2] - [build, 2]
- [pipeline, 2] - [pipeline, 2]
- [pipelines-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]
......
...@@ -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 'pipelines-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 'pipelines-build-processing' .to eq 'pipeline_processing'
end end
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment