summaryrefslogtreecommitdiff
path: root/lib/gitlab/exclusive_lease.rb
diff options
context:
space:
mode:
authorJacob Vosmaer <contact@jacobvosmaer.nl>2016-03-16 18:10:03 +0100
committerJacob Vosmaer <contact@jacobvosmaer.nl>2016-04-04 17:00:09 +0200
commit0163e27631fb993bd3541c09a95f0ef5e2026455 (patch)
treeb63cff41fe7d6e7433ecacfefd8be17e4fa29422 /lib/gitlab/exclusive_lease.rb
parentba7fcc9866588eb215fc69f5d8b73c77805e4eef (diff)
downloadgitlab-ce-0163e27631fb993bd3541c09a95f0ef5e2026455.tar.gz
Add Gitlab::Redis connection pool
Diffstat (limited to 'lib/gitlab/exclusive_lease.rb')
-rw-r--r--lib/gitlab/exclusive_lease.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/gitlab/exclusive_lease.rb b/lib/gitlab/exclusive_lease.rb
index c73eca832d7..c2260a5f7ac 100644
--- a/lib/gitlab/exclusive_lease.rb
+++ b/lib/gitlab/exclusive_lease.rb
@@ -43,7 +43,9 @@ module Gitlab
# false if the lease is already taken.
def try_obtain
# Performing a single SET is atomic
- !!redis.set(redis_key, '1', nx: true, ex: @timeout)
+ Gitlab::Redis.with do |redis|
+ !!redis.set(redis_key, '1', nx: true, ex: @timeout)
+ end
end
# No #cancel method. See comments above!