summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-07-26 14:50:48 +0200
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-07-26 14:50:48 +0200
commit7d6538f2e2a6f1b0808a77e347a9083295b17c8c (patch)
tree0931d441724c26c1cce14afb06d3b4166ac86304 /app
parentf4e01b597c7cb40797d0b690451322bc79d8dfe0 (diff)
downloadgitlab-ce-7d6538f2e2a6f1b0808a77e347a9083295b17c8c.tar.gz
Rename method responsible for updating stage status
Diffstat (limited to 'app')
-rw-r--r--app/models/ci/stage.rb2
-rw-r--r--app/workers/stage_update_worker.rb4
2 files changed, 4 insertions, 2 deletions
diff --git a/app/models/ci/stage.rb b/app/models/ci/stage.rb
index b1cca06abaa..cd2f1dd3509 100644
--- a/app/models/ci/stage.rb
+++ b/app/models/ci/stage.rb
@@ -50,7 +50,7 @@ module Ci
end
end
- def update!
+ def update_status
retry_optimistic_lock(self) do
case commit_statuses.latest.status
when 'pending' then enqueue
diff --git a/app/workers/stage_update_worker.rb b/app/workers/stage_update_worker.rb
index 1d6f23305d6..eef0b11e70b 100644
--- a/app/workers/stage_update_worker.rb
+++ b/app/workers/stage_update_worker.rb
@@ -3,6 +3,8 @@ class StageUpdateWorker
include PipelineQueue
def perform(stage_id)
- Ci::Stage.find_by(id: stage_id)&.update!
+ Ci::Stage.find_by(id: stage_id).try do |stage|
+ stage.update_status
+ end
end
end