summaryrefslogtreecommitdiff
path: root/app/models
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-10-03 16:30:11 +0200
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2016-10-04 14:43:24 +0200
commit7d4767fb4830a88f345c3b71e78b07771d2f3f06 (patch)
treedca0d85debbc4e0f7238b1590262dc8b7a914f2f /app/models
parent578638742ab431a57f9add51684203b0d1c19348 (diff)
downloadgitlab-ce-7d4767fb4830a88f345c3b71e78b07771d2f3f06.tar.gz
Extract updating pipeline status to async worker
Diffstat (limited to 'app/models')
-rw-r--r--app/models/commit_status.rb12
1 files changed, 8 insertions, 4 deletions
diff --git a/app/models/commit_status.rb b/app/models/commit_status.rb
index 966a2449d2c..09aec6b40d0 100644
--- a/app/models/commit_status.rb
+++ b/app/models/commit_status.rb
@@ -78,10 +78,14 @@ class CommitStatus < ActiveRecord::Base
end
after_transition do |commit_status, transition|
- if commit_status.pipeline && !transition.loopback?
- ProcessPipelineWorker.perform_async(
- commit_status.pipeline.id, process: commit_status.complete?
- )
+ return if transition.loopback?
+
+ commit_status.pipeline.try(:id).try do |pipeline_id|
+ if commit_status.complete?
+ ProcessPipelineWorker.perform_async(pipeline_id)
+ end
+
+ UpdatePipelineWorker.perform_async(pipeline_id)
end
true