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

Merge pull request #142 from Deradon/fix-running-builds

Try to make Runner.rb transactional safe
parents 2eabc6c3 e2100b06
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -15,10 +15,12 @@ class Runner
 
return true if @build.canceled?
 
if @project.no_running_builds?
run
else
run_later
run_in_transaction ? run : run_later
end
def run_in_transaction
ActiveRecord::Base.transaction do
build.run! if project.no_running_builds?
end
end
 
Loading
Loading
@@ -37,8 +39,6 @@ class Runner
commands = commands.lines.to_a
commands.unshift(prepare_project_cmd(path, build.sha))
 
build.run!
Dir.chdir(path) do
commands.each do |line|
status = command(line, path)
Loading
Loading
@@ -91,7 +91,7 @@ class Runner
@process.environment['CI_SERVER_REVISION'] = GitlabCi::Revision
 
@process.environment['CI_BUILD_REF'] = build.ref
@process.start
 
build.set_file @tmp_file.path
Loading
Loading
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