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

Simplify pipeline sidekiq queues naming scheme

parent ce274fd6
......@@ -5,14 +5,14 @@ module PipelineQueue
extend ActiveSupport::Concern
included do
sidekiq_options queue: 'pipelines-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: "pipelines-#{queue}-#{group}"
sidekiq_options queue: "pipeline_#{group}"
end
end
end
......@@ -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)
......
......@@ -27,7 +27,7 @@
- [new_merge_request, 2]
- [build, 2]
- [pipeline, 2]
- [pipelines-pipeline-processing, 2]
- [pipeline_processing, 2]
- [gitlab_shell, 2]
- [email_receiver, 2]
- [emails_on_push, 2]
......
......@@ -10,15 +10,15 @@ describe PipelineQueue do
it 'sets a default pipelines queue automatically' do
expect(worker.sidekiq_options['queue'])
.to eq 'pipelines-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 'pipelines-build-processing'
.to eq 'pipeline_processing'
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