diff options
author | Phil Hughes <me@iamphill.com> | 2016-11-24 14:31:59 +0300 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2016-11-24 14:31:59 +0300 |
commit | 79a791a30d60d04be34d0e6d36c9cc145b97635b (patch) | |
tree | 7495834ed7bdfb51946c5f40fc61f1568ff0f823 /app/services/ci/process_pipeline_service.rb | |
parent | fa04393482eff8d7d7cdb71c3bdea2c918a49a57 (diff) | |
parent | 3e44ed3e2bf75bb14a2d8b0466b3d92afd0ea067 (diff) |
Merge branch 'master' into menu-resize-hidemenu-resize-hide
Diffstat (limited to 'app/services/ci/process_pipeline_service.rb')
-rw-r--r-- | app/services/ci/process_pipeline_service.rb | 23 |
1 files changed, 12 insertions, 11 deletions
diff --git a/app/services/ci/process_pipeline_service.rb b/app/services/ci/process_pipeline_service.rb index 36c93dddadb..8face432d97 100644 --- a/app/services/ci/process_pipeline_service.rb +++ b/app/services/ci/process_pipeline_service.rb @@ -10,15 +10,14 @@ module Ci create_builds! end - @pipeline.with_lock do - new_builds = - stage_indexes_of_created_builds.map do |index| - process_stage(index) - end + new_builds = + stage_indexes_of_created_builds.map do |index| + process_stage(index) + end - # Return a flag if a when builds got enqueued - new_builds.flatten.any? - end + @pipeline.update_status + + new_builds.flatten.any? end private @@ -30,9 +29,11 @@ module Ci def process_stage(index) current_status = status_for_prior_stages(index) - created_builds_in_stage(index).select do |build| - if HasStatus::COMPLETED_STATUSES.include?(current_status) - process_build(build, current_status) + if HasStatus::COMPLETED_STATUSES.include?(current_status) + created_builds_in_stage(index).select do |build| + Gitlab::OptimisticLocking.retry_lock(build) do |subject| + process_build(subject, current_status) + end end end end |