diff options
author | Jacob Vosmaer <contact@jacobvosmaer.nl> | 2016-03-16 18:10:03 +0100 |
---|---|---|
committer | Jacob Vosmaer <contact@jacobvosmaer.nl> | 2016-04-04 17:00:09 +0200 |
commit | 0163e27631fb993bd3541c09a95f0ef5e2026455 (patch) | |
tree | b63cff41fe7d6e7433ecacfefd8be17e4fa29422 /lib/gitlab/exclusive_lease.rb | |
parent | ba7fcc9866588eb215fc69f5d8b73c77805e4eef (diff) | |
download | gitlab-ce-0163e27631fb993bd3541c09a95f0ef5e2026455.tar.gz |
Add Gitlab::Redis connection pool
Diffstat (limited to 'lib/gitlab/exclusive_lease.rb')
-rw-r--r-- | lib/gitlab/exclusive_lease.rb | 4 |
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! |