summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-10-21 15:12:11 +0200
committerKamil Trzcinski <ayufan@ayufan.eu>2016-10-26 11:37:23 +0200
commit47b2add4f62d64d1a46109910c86805728e548c4 (patch)
tree58bee6cd9dbd1f4b7be7761578b9a18486998b36 /app
parent5d7ee7a1b6c818dd0ccba6a393875072dabd7eba (diff)
downloadgitlab-ce-47b2add4f62d64d1a46109910c86805728e548c4.tar.gz
Add tests for optimistic locking
Diffstat (limited to 'app')
-rw-r--r--app/models/ci/pipeline.rb2
-rw-r--r--app/services/ci/register_build_service.rb2
2 files changed, 2 insertions, 2 deletions
diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb
index 27178e2a6c1..d3432632899 100644
--- a/app/models/ci/pipeline.rb
+++ b/app/models/ci/pipeline.rb
@@ -260,7 +260,7 @@ module Ci
end
def update_status
- Gitlab::OptimisticLocking.retry_lock(build) do
+ Gitlab::OptimisticLocking.retry_lock(self) do
case latest_builds_status
when 'pending' then enqueue
when 'running' then run
diff --git a/app/services/ci/register_build_service.rb b/app/services/ci/register_build_service.rb
index 8d3bc8e2dee..74b5ebf372b 100644
--- a/app/services/ci/register_build_service.rb
+++ b/app/services/ci/register_build_service.rb
@@ -35,7 +35,7 @@ module Ci
build
- rescue StateMachines::InvalidTransition, StaleObjectError
+ rescue StateMachines::InvalidTransition, ActiveRecord::StaleObjectError
nil
end