summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil Trzciński (OoO till 16th of April) <ayufan@ayufan.eu>2018-04-18 08:46:46 +0000
committerKamil Trzciński (OoO till 16th of April) <ayufan@ayufan.eu>2018-04-18 08:46:46 +0000
commit3529ccae9e3a484da5a4fba32bfdf0317f289363 (patch)
tree10e500d412682e8c6e17bc55930b6847cb9824e2
parent4e64c9f4a2ddbee218fe1b3142e8d605c5e2966b (diff)
parent33de33198560844a32e4ed60f9f6476b7c6aa6aa (diff)
downloadgitlab-ce-3529ccae9e3a484da5a4fba32bfdf0317f289363.tar.gz
Merge branch '45456-improve-performance-of-cicd-jobs-request' into 'master'
Resolve "Concurrent requests to api/v4/jobs/request cause DB locks on ci_builds_metadata table" Closes #45456 See merge request gitlab-org/gitlab-ce!18428
-rw-r--r--app/models/ci/build.rb2
-rw-r--r--spec/models/ci/build_spec.rb4
2 files changed, 1 insertions, 5 deletions
diff --git a/app/models/ci/build.rb b/app/models/ci/build.rb
index 4aa65bf4273..3e3ef674dff 100644
--- a/app/models/ci/build.rb
+++ b/app/models/ci/build.rb
@@ -162,7 +162,7 @@ module Ci
build.validates_dependencies! unless Feature.enabled?('ci_disable_validates_dependencies')
end
- before_transition pending: :running do |build|
+ after_transition pending: :running do |build|
build.ensure_metadata.update_timeout_state
end
end
diff --git a/spec/models/ci/build_spec.rb b/spec/models/ci/build_spec.rb
index a12717835b0..d7075d4a6b4 100644
--- a/spec/models/ci/build_spec.rb
+++ b/spec/models/ci/build_spec.rb
@@ -2140,10 +2140,6 @@ describe Ci::Build do
it "doesn't save timeout_source" do
expect { run_job_without_exception }.not_to change { job.reload.ensure_metadata.timeout_source }
end
-
- it 'raises an exception' do
- expect { job.run! }.to raise_error(StateMachines::InvalidTransition)
- end
end
end