diff options
author | Robert Speicher <robert@gitlab.com> | 2016-08-31 18:56:48 +0300 |
---|---|---|
committer | Ruben Davila <rdavila84@gmail.com> | 2016-08-31 19:52:02 +0300 |
commit | a4ab9759ea614d9807ccf3476ca958f72b4db3c1 (patch) | |
tree | b3267f371bcdbb6e9df2e7488a5ed4cbd96779d9 /app | |
parent | 77f99c5be4d1802cba705d6cbba4e7cdd8a7f386 (diff) |
Merge branch 'block-concurrent-pipeline-processings' into 'master'
Block concurrent pipeline processings
## What does this MR do?
It's possible that two builds that succeed at the same will try to
concurrently process pipeline. This can lead to scenario when it will
fail to trigger next stages.
This MR makes sure that process of updating is blocking.
Fixes https://gitlab.com/gitlab-org/gitlab-ce/issues/21263
See merge request !6090
Diffstat (limited to 'app')
-rw-r--r-- | app/services/ci/process_pipeline_service.rb | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/app/services/ci/process_pipeline_service.rb b/app/services/ci/process_pipeline_service.rb index 6f7610d42ba..e38709853cd 100644 --- a/app/services/ci/process_pipeline_service.rb +++ b/app/services/ci/process_pipeline_service.rb @@ -10,13 +10,15 @@ module Ci create_builds! end - new_builds = - stage_indexes_of_created_builds.map do |index| - process_stage(index) - end + @pipeline.with_lock do + 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? + # Return a flag if a when builds got enqueued + new_builds.flatten.any? + end end private |