Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-10-03 17:30:11 +0300
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-10-04 15:43:24 +0300
commit7d4767fb4830a88f345c3b71e78b07771d2f3f06 (patch)
treedca0d85debbc4e0f7238b1590262dc8b7a914f2f /app/workers
parent578638742ab431a57f9add51684203b0d1c19348 (diff)
Extract updating pipeline status to async worker
Diffstat (limited to 'app/workers')
-rw-r--r--app/workers/process_pipeline_worker.rb13
-rw-r--r--app/workers/update_pipeline_worker.rb12
2 files changed, 16 insertions, 9 deletions
diff --git a/app/workers/process_pipeline_worker.rb b/app/workers/process_pipeline_worker.rb
index fa1251b8e9f..9aad8cf818f 100644
--- a/app/workers/process_pipeline_worker.rb
+++ b/app/workers/process_pipeline_worker.rb
@@ -3,15 +3,10 @@ class ProcessPipelineWorker
sidekiq_options queue: :default
- def perform(pipeline_id, params)
- begin
- pipeline = Ci::Pipeline.find(pipeline_id)
- rescue ActiveRecord::RecordNotFound
- return
- end
+ def perform(pipeline_id)
+ pipeline = Ci::Pipeline.find_by(id: pipeline_id)
+ return unless pipeline
- pipeline.process! if params['process']
-
- pipeline.update_status
+ pipeline.process!
end
end
diff --git a/app/workers/update_pipeline_worker.rb b/app/workers/update_pipeline_worker.rb
new file mode 100644
index 00000000000..31d29d0ab1c
--- /dev/null
+++ b/app/workers/update_pipeline_worker.rb
@@ -0,0 +1,12 @@
+class UpdatePipelineWorker
+ include Sidekiq::Worker
+
+ sidekiq_options queue: :default
+
+ def perform(pipeline_id)
+ pipeline = Ci::Pipeline.find_by(id: pipeline_id)
+ return unless pipeline
+
+ pipeline.update_status
+ end
+end