summaryrefslogtreecommitdiff
path: root/lib/gitlab/exclusive_lease_helpers.rb
diff options
context:
space:
mode:
authorKamil Trzciński <ayufan@ayufan.eu>2018-11-23 17:25:11 +0100
committerKamil Trzciński <ayufan@ayufan.eu>2018-11-27 17:55:20 +0100
commit31a1ce2132d83e333e84f365b9aada2e17c61b43 (patch)
tree66d3a02000d2998f7b6f583ed669fd59939c88e7 /lib/gitlab/exclusive_lease_helpers.rb
parent2e3dab38295b7c36ab100f20c654fdfaf9b00885 (diff)
downloadgitlab-ce-31a1ce2132d83e333e84f365b9aada2e17c61b43.tar.gz
Lock writes to trace stream
Diffstat (limited to 'lib/gitlab/exclusive_lease_helpers.rb')
-rw-r--r--lib/gitlab/exclusive_lease_helpers.rb2
1 files changed, 2 insertions, 0 deletions
diff --git a/lib/gitlab/exclusive_lease_helpers.rb b/lib/gitlab/exclusive_lease_helpers.rb
index 4aaf2474763..7961d4bbd6e 100644
--- a/lib/gitlab/exclusive_lease_helpers.rb
+++ b/lib/gitlab/exclusive_lease_helpers.rb
@@ -12,6 +12,8 @@ module Gitlab
# because it holds the connection until all `retries` is consumed.
# This could potentially eat up all connection pools.
def in_lock(key, ttl: 1.minute, retries: 10, sleep_sec: 0.01.seconds)
+ raise ArgumentError, 'Key needs to be specified' unless key
+
lease = Gitlab::ExclusiveLease.new(key, timeout: ttl)
until uuid = lease.try_obtain