From 7f270d041da55e1fd5c378dcf2291ba752a9114d Mon Sep 17 00:00:00 2001
From: Grzegorz Bizon <grzesiek.bizon@gmail.com>
Date: Tue, 4 Oct 2016 16:34:22 +0200
Subject: [PATCH] Do not return false in commit status transition

---
 app/models/commit_status.rb            | 2 +-
 app/workers/process_pipeline_worker.rb | 5 ++---
 app/workers/update_pipeline_worker.rb  | 5 ++---
 3 files changed, 5 insertions(+), 7 deletions(-)

diff --git a/app/models/commit_status.rb b/app/models/commit_status.rb
index 4bb4211dfe3..b0b4f94e070 100644
--- a/app/models/commit_status.rb
+++ b/app/models/commit_status.rb
@@ -71,7 +71,7 @@ class CommitStatus < ActiveRecord::Base
 
     after_transition do |commit_status, transition|
       commit_status.pipeline.try do |pipeline|
-        return false if transition.loopback?
+        break if transition.loopback?
 
         if commit_status.complete?
           ProcessPipelineWorker.perform_async(pipeline.id)
diff --git a/app/workers/process_pipeline_worker.rb b/app/workers/process_pipeline_worker.rb
index 189cfa207ff..26ea5f1c24d 100644
--- a/app/workers/process_pipeline_worker.rb
+++ b/app/workers/process_pipeline_worker.rb
@@ -4,8 +4,7 @@ class ProcessPipelineWorker
   sidekiq_options queue: :default
 
   def perform(pipeline_id)
-    Ci::Pipeline.find_by(id: pipeline_id).try do |pipeline|
-      pipeline.process!
-    end
+    Ci::Pipeline.find_by(id: pipeline_id)
+      .try(:process!)
   end
 end
diff --git a/app/workers/update_pipeline_worker.rb b/app/workers/update_pipeline_worker.rb
index 9fd622a0970..6ef5678073e 100644
--- a/app/workers/update_pipeline_worker.rb
+++ b/app/workers/update_pipeline_worker.rb
@@ -4,8 +4,7 @@ class UpdatePipelineWorker
   sidekiq_options queue: :default
 
   def perform(pipeline_id)
-    Ci::Pipeline.find_by(id: pipeline_id).try do |pipeline|
-      pipeline.update_status
-    end
+    Ci::Pipeline.find_by(id: pipeline_id)
+      .try(:update_status)
   end
 end
-- 
GitLab