From 6baf9971db231a2c9923bd4d73e1f59fe255aab8 Mon Sep 17 00:00:00 2001 From: Lin Jen-Shin Date: Mon, 12 Sep 2016 21:27:46 +0800 Subject: [PATCH] Revert "reload instead, so that we don't have to change order" This reverts commit 575dc2b0d78b2680d6e5bb43f293c98d378b8733. --- app/models/commit_status.rb | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) diff --git a/app/models/commit_status.rb b/app/models/commit_status.rb index ad4e1c25231..438f807b118 100644 --- a/app/models/commit_status.rb +++ b/app/models/commit_status.rb @@ -69,20 +69,13 @@ class CommitStatus < ActiveRecord::Base commit_status.update_attributes finished_at: Time.now end - # We use around_transition to process pipeline on next stages as soon as possible, before the `after_*` is executed - around_transition any => [:success, :failed, :canceled] do |commit_status, block| - block.call - - commit_status.pipeline.try(:process!) - true + after_transition do |commit_status, transition| + commit_status.pipeline.try(:build_updated) unless transition.loopback? end - after_transition do |commit_status, transition| - pipeline = commit_status.pipeline - if !transition.loopback? && pipeline - pipeline.reload - pipeline.build_updated - end + after_transition any => [:success, :failed, :canceled] do |commit_status| + commit_status.pipeline.try(:process!) + true end after_transition [:created, :pending, :running] => :success do |commit_status|