diff options
author | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-08-11 20:54:02 +0200 |
---|---|---|
committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-08-11 21:32:16 +0200 |
commit | 6a6a69f4afbe0107a75df018b662f02b5ec0166a (patch) | |
tree | b7a49ab9b0913d90251245648a885de9442708c9 /app/models/commit_status.rb | |
parent | d983c5bd4671d989edf3741d0db0a54dcef9c3b6 (diff) | |
download | gitlab-ce-6a6a69f4afbe0107a75df018b662f02b5ec0166a.tar.gz |
Use state machine for pipeline event processing
Diffstat (limited to 'app/models/commit_status.rb')
-rw-r--r-- | app/models/commit_status.rb | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/app/models/commit_status.rb b/app/models/commit_status.rb index 3ab44461179..64ce5431d63 100644 --- a/app/models/commit_status.rb +++ b/app/models/commit_status.rb @@ -74,13 +74,13 @@ class CommitStatus < ActiveRecord::Base around_transition any => [:success, :failed, :canceled] do |commit_status, block| block.call - commit_status.pipeline.process! if commit_status.pipeline + commit_status.pipeline.try(:process!) end - around_transition any => [:pending, :running] do |commit_status, block| - block.call + # Try to update the pipeline status - commit_status.pipeline.reload_status! if commit_status.pipeline + after_transition do |commit_status, transition| + commit_status.pipeline.try(:update_status) unless transition.loopback? end end |