summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomasz Maczukin <tomasz@maczukin.pl>2017-02-07 23:08:02 +0100
committerTomasz Maczukin <tomasz@maczukin.pl>2017-03-01 13:29:52 +0100
commite9f83c4bd9d6b596d647f9347d0014b3ab2cca3e (patch)
treea3f1df8b5e7474d67a401ed89ba1a3342ae4b6dc
parent0ba385b363879f270c767aab6c1799a8e675a263 (diff)
downloadgitlab-ce-e9f83c4bd9d6b596d647f9347d0014b3ab2cca3e.tar.gz
Add Gitlab::OptimisticLocking for build dropping
-rw-r--r--app/workers/stuck_ci_builds_worker.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/app/workers/stuck_ci_builds_worker.rb b/app/workers/stuck_ci_builds_worker.rb
index 4eba311d063..3b18fe3dd26 100644
--- a/app/workers/stuck_ci_builds_worker.rb
+++ b/app/workers/stuck_ci_builds_worker.rb
@@ -47,6 +47,8 @@ class StuckCiBuildsWorker
def drop_build(type, build, status, timeout)
Rails.logger.info "#{self.class}: Dropping #{type} build #{build.id} for runner #{build.runner_id} (status: #{status}, timeout: #{timeout})"
- build.drop
+ Gitlab::OptimisticLocking.retry_lock(build, 3) do |b|
+ b.drop
+ end
end
end