Commit 4c936682 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Remove sidekiq build queue and assign pipeline queue

parent 84175072
class BuildCoverageWorker class BuildCoverageWorker
include Sidekiq::Worker include Sidekiq::Worker
include BuildQueue include PipelineQueue
enqueue_in group: :processing
def perform(build_id) def perform(build_id)
Ci::Build.find_by(id: build_id)&.update_coverage Ci::Build.find_by(id: build_id)&.update_coverage
......
class BuildFinishedWorker class BuildFinishedWorker
include Sidekiq::Worker include Sidekiq::Worker
include BuildQueue include PipelineQueue
enqueue_in group: :processing
def perform(build_id) def perform(build_id)
Ci::Build.find_by(id: build_id).try do |build| Ci::Build.find_by(id: build_id).try do |build|
......
class BuildHooksWorker class BuildHooksWorker
include Sidekiq::Worker include Sidekiq::Worker
include BuildQueue include PipelineQueue
enqueue_in group: :hooks
def perform(build_id) def perform(build_id)
Ci::Build.find_by(id: build_id) Ci::Build.find_by(id: build_id)
......
class BuildSuccessWorker class BuildSuccessWorker
include Sidekiq::Worker include Sidekiq::Worker
include BuildQueue include PipelineQueue
enqueue_in group: :processing
def perform(build_id) def perform(build_id)
Ci::Build.find_by(id: build_id).try do |build| Ci::Build.find_by(id: build_id).try do |build|
......
# Concern for setting Sidekiq settings for the various CI build workers.
module BuildQueue
extend ActiveSupport::Concern
included do
sidekiq_options queue: :build
end
end
class ExpireJobCacheWorker class ExpireJobCacheWorker
include Sidekiq::Worker include Sidekiq::Worker
include BuildQueue include PipelineQueue
enqueue_in group: :cache
def perform(job_id) def perform(job_id)
job = CommitStatus.joins(:pipeline, :project).find_by(id: job_id) job = CommitStatus.joins(:pipeline, :project).find_by(id: job_id)
......
...@@ -20,4 +20,6 @@ describe BuildCoverageWorker do ...@@ -20,4 +20,6 @@ describe BuildCoverageWorker do
end end
end end
end end
it_behaves_like 'sidekiq_worker'
end end
...@@ -27,4 +27,6 @@ describe BuildFinishedWorker do ...@@ -27,4 +27,6 @@ describe BuildFinishedWorker do
end end
end end
end end
it_behaves_like 'sidekiq worker'
end end
...@@ -20,4 +20,6 @@ describe BuildHooksWorker do ...@@ -20,4 +20,6 @@ describe BuildHooksWorker do
end end
end end
end end
it_behaves_like 'sidekiq worker'
end end
...@@ -33,4 +33,6 @@ describe BuildSuccessWorker do ...@@ -33,4 +33,6 @@ describe BuildSuccessWorker do
end end
end end
end end
it_behaves_like 'sidekiq worker'
end end
require 'spec_helper'
describe BuildQueue do
let(:worker) do
Class.new do
include Sidekiq::Worker
include BuildQueue
end
end
it 'sets the queue name of a worker' do
expect(worker.sidekiq_options['queue'].to_s).to eq('build')
end
end
...@@ -28,4 +28,6 @@ describe ExpireJobCacheWorker do ...@@ -28,4 +28,6 @@ describe ExpireJobCacheWorker do
end end
end end
end end
it_behaves_like 'sidekiq worker'
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