Commit 84175072 authored by Grzegorz Bizon's avatar Grzegorz Bizon

Assign all pipeline workers to specific queues

parent 48776f27
...@@ -2,6 +2,8 @@ class ExpirePipelineCacheWorker ...@@ -2,6 +2,8 @@ class ExpirePipelineCacheWorker
include Sidekiq::Worker include Sidekiq::Worker
include PipelineQueue include PipelineQueue
enqueue_in group: :cache
def perform(pipeline_id) def perform(pipeline_id)
pipeline = Ci::Pipeline.find_by(id: pipeline_id) pipeline = Ci::Pipeline.find_by(id: pipeline_id)
return unless pipeline return unless pipeline
......
...@@ -2,6 +2,8 @@ class PipelineHooksWorker ...@@ -2,6 +2,8 @@ class PipelineHooksWorker
include Sidekiq::Worker include Sidekiq::Worker
include PipelineQueue include PipelineQueue
enqueue_in group: :hooks
def perform(pipeline_id) def perform(pipeline_id)
Ci::Pipeline.find_by(id: pipeline_id) Ci::Pipeline.find_by(id: pipeline_id)
.try(:execute_hooks) .try(:execute_hooks)
......
...@@ -2,6 +2,8 @@ class PipelineMetricsWorker ...@@ -2,6 +2,8 @@ class PipelineMetricsWorker
include Sidekiq::Worker include Sidekiq::Worker
include PipelineQueue include PipelineQueue
enqueue_in group: :metrics
def perform(pipeline_id) def perform(pipeline_id)
Ci::Pipeline.find_by(id: pipeline_id).try do |pipeline| Ci::Pipeline.find_by(id: pipeline_id).try do |pipeline|
update_metrics_for_active_pipeline(pipeline) if pipeline.active? update_metrics_for_active_pipeline(pipeline) if pipeline.active?
......
...@@ -2,6 +2,8 @@ class PipelineNotificationWorker ...@@ -2,6 +2,8 @@ class PipelineNotificationWorker
include Sidekiq::Worker include Sidekiq::Worker
include PipelineQueue include PipelineQueue
enqueue_in group: :hooks
def perform(pipeline_id, recipients = nil) def perform(pipeline_id, recipients = nil)
pipeline = Ci::Pipeline.find_by(id: pipeline_id) pipeline = Ci::Pipeline.find_by(id: pipeline_id)
......
...@@ -2,6 +2,8 @@ class PipelineProcessWorker ...@@ -2,6 +2,8 @@ class PipelineProcessWorker
include Sidekiq::Worker include Sidekiq::Worker
include PipelineQueue include PipelineQueue
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)
.try(:process!) .try(:process!)
......
...@@ -2,6 +2,8 @@ class PipelineSuccessWorker ...@@ -2,6 +2,8 @@ class PipelineSuccessWorker
include Sidekiq::Worker include Sidekiq::Worker
include PipelineQueue include PipelineQueue
enqueue_in group: :processing
def perform(pipeline_id) def perform(pipeline_id)
Ci::Pipeline.find_by(id: pipeline_id).try do |pipeline| Ci::Pipeline.find_by(id: pipeline_id).try do |pipeline|
MergeRequests::MergeWhenPipelineSucceedsService MergeRequests::MergeWhenPipelineSucceedsService
......
...@@ -28,6 +28,9 @@ ...@@ -28,6 +28,9 @@
- [build, 2] - [build, 2]
- [pipeline, 2] - [pipeline, 2]
- [pipeline_processing, 2] - [pipeline_processing, 2]
- [pipeline_cache, 2]
- [pipeline_metrics, 2]
- [pipeline_hooks, 2]
- [gitlab_shell, 2] - [gitlab_shell, 2]
- [email_receiver, 2] - [email_receiver, 2]
- [emails_on_push, 2] - [emails_on_push, 2]
......
...@@ -43,4 +43,6 @@ describe ExpirePipelineCacheWorker do ...@@ -43,4 +43,6 @@ describe ExpirePipelineCacheWorker do
subject.perform(pipeline.id) subject.perform(pipeline.id)
end end
end end
it_behaves_like 'sidekiq worker'
end end
...@@ -20,4 +20,6 @@ describe PipelineHooksWorker do ...@@ -20,4 +20,6 @@ describe PipelineHooksWorker do
end end
end end
end end
it_behaves_like 'sidekiq worker'
end end
...@@ -47,4 +47,6 @@ describe PipelineMetricsWorker do ...@@ -47,4 +47,6 @@ describe PipelineMetricsWorker do
end end
end end
end end
it_behaves_like 'sidekiq worker'
end end
...@@ -16,4 +16,6 @@ describe PipelineNotificationWorker, :mailer do ...@@ -16,4 +16,6 @@ describe PipelineNotificationWorker, :mailer do
subject.perform(Ci::Pipeline.maximum(:id).to_i.succ) subject.perform(Ci::Pipeline.maximum(:id).to_i.succ)
end end
end end
it_behaves_like 'sidekiq worker'
end end
...@@ -19,4 +19,6 @@ describe PipelineProcessWorker do ...@@ -19,4 +19,6 @@ describe PipelineProcessWorker do
end end
end end
end end
it_behaves_like 'sidekiq worker'
end end
...@@ -21,4 +21,6 @@ describe PipelineSuccessWorker do ...@@ -21,4 +21,6 @@ describe PipelineSuccessWorker 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