Revert "reload instead, so that we don't have to change order"

This reverts commit 575dc2b0d7.
This commit is contained in:
Lin Jen-Shin 2016-09-12 21:27:46 +08:00
parent 575dc2b0d7
commit 6baf9971db

View file

@ -69,20 +69,13 @@ class CommitStatus < ActiveRecord::Base
commit_status.update_attributes finished_at: Time.now commit_status.update_attributes finished_at: Time.now
end end
# We use around_transition to process pipeline on next stages as soon as possible, before the `after_*` is executed after_transition do |commit_status, transition|
around_transition any => [:success, :failed, :canceled] do |commit_status, block| commit_status.pipeline.try(:build_updated) unless transition.loopback?
block.call
commit_status.pipeline.try(:process!)
true
end end
after_transition do |commit_status, transition| after_transition any => [:success, :failed, :canceled] do |commit_status|
pipeline = commit_status.pipeline commit_status.pipeline.try(:process!)
if !transition.loopback? && pipeline true
pipeline.reload
pipeline.build_updated
end
end end
after_transition [:created, :pending, :running] => :success do |commit_status| after_transition [:created, :pending, :running] => :success do |commit_status|