From 31a1ce2132d83e333e84f365b9aada2e17c61b43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kamil=20Trzci=C5=84ski?= Date: Fri, 23 Nov 2018 17:25:11 +0100 Subject: Lock writes to trace stream --- lib/gitlab/exclusive_lease_helpers.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'lib/gitlab/exclusive_lease_helpers.rb') 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 -- cgit v1.2.3