Skip to content
Snippets Groups Projects
Commit 444cac65 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets
Browse files

Merge branch 'concurent_runners' into 'master'

Resolve situation with concurent runners registration

https://dev.gitlab.org/gitlab/gitlab-ci/issues/209

https://github.com/gitlabhq/gitlab-ci/issues/458

See merge request !82
parents 0783a659 96ddc548
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -25,7 +25,9 @@ class RegisterBuildService
end
 
if build
ActiveRecord::Base.transaction do
# In case when 2 runners try to assign the same build, second runner will be declined
# with StateMachine::InvalidTransition in run! method.
build.with_lock do
build.runner_id = current_runner.id
build.save!
build.run!
Loading
Loading
@@ -33,5 +35,8 @@ class RegisterBuildService
end
 
build
rescue StateMachine::InvalidTransition
nil
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment