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:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-09-19 16:03:51 +0300
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-10-03 13:34:05 +0300
commit4567e624a06358f0e3451be51d134f8dd22c199d (patch)
tree6a45033ce16277554e84586535d661c38a346c3a /app/workers
parentd9f9ad9d7d672574a227dd6143cd3d08f2381be5 (diff)
Make pipeline processing asynchronous
Conflicts: app/models/ci/pipeline.rb app/models/commit_status.rb
Diffstat (limited to 'app/workers')
-rw-r--r--app/workers/process_pipeline_worker.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/app/workers/process_pipeline_worker.rb b/app/workers/process_pipeline_worker.rb
new file mode 100644
index 00000000000..fb59a1efb7a
--- /dev/null
+++ b/app/workers/process_pipeline_worker.rb
@@ -0,0 +1,17 @@
+class ProcessPipelineWorker
+ include Sidekiq::Worker
+
+ sidekiq_options queue: :default
+
+ def perform(pipeline_id, params)
+ begin
+ pipeline = Ci::Pipeline.find(pipeline_id)
+ rescue ActiveRecord::RecordNotFound
+ return
+ end
+
+ pipeline.process! if params[:process]
+
+ pipeline.update_status
+ end
+end