From e4eac1fff1ba6d890f9f028dbfe47918b7876688 Mon Sep 17 00:00:00 2001 From: Douwe Maan Date: Thu, 1 Jun 2017 16:36:04 -0500 Subject: =?UTF-8?q?Don=E2=80=99t=20schedule=20workers=20from=20inside=20tr?= =?UTF-8?q?ansactions?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/commit_status.rb | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'app/models/commit_status.rb') diff --git a/app/models/commit_status.rb b/app/models/commit_status.rb index fe63728ea23..ce507f7774b 100644 --- a/app/models/commit_status.rb +++ b/app/models/commit_status.rb @@ -18,7 +18,7 @@ class CommitStatus < ActiveRecord::Base validates :name, presence: true alias_attribute :author, :user - + scope :failed_but_allowed, -> do where(allow_failure: true, status: [:failed, :canceled]) end @@ -83,14 +83,15 @@ class CommitStatus < ActiveRecord::Base next if transition.loopback? commit_status.run_after_commit do - pipeline.try do |pipeline| + if pipeline if complete? || manual? PipelineProcessWorker.perform_async(pipeline.id) else PipelineUpdateWorker.perform_async(pipeline.id) end - ExpireJobCacheWorker.perform_async(commit_status.id) end + + ExpireJobCacheWorker.perform_async(commit_status.id) end end -- cgit v1.2.1 From 1709e5cf876cf92c939464a633ddc6858b506e4f Mon Sep 17 00:00:00 2001 From: "Z.J. van de Weg" Date: Sun, 4 Jun 2017 12:44:00 +0200 Subject: retryable? is now available for CommitStatus --- app/models/commit_status.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'app/models/commit_status.rb') diff --git a/app/models/commit_status.rb b/app/models/commit_status.rb index fe63728ea23..d08c79cb055 100644 --- a/app/models/commit_status.rb +++ b/app/models/commit_status.rb @@ -18,7 +18,7 @@ class CommitStatus < ActiveRecord::Base validates :name, presence: true alias_attribute :author, :user - + scope :failed_but_allowed, -> do where(allow_failure: true, status: [:failed, :canceled]) end @@ -126,6 +126,11 @@ class CommitStatus < ActiveRecord::Base false end + # To be overriden when inherrited from + def retryable? + false + end + def stuck? false end -- cgit v1.2.1