diff options
author | Jacob Vosmaer <contact@jacobvosmaer.nl> | 2016-03-10 19:05:36 +0300 |
---|---|---|
committer | Jacob Vosmaer <contact@jacobvosmaer.nl> | 2016-03-10 19:05:36 +0300 |
commit | 3729c0822a51c74ac775c84d005f664aca40f3dd (patch) | |
tree | 2cdd556cc8ebe6a25aa4b31361a38a12e19453fc /lib/gitlab/exclusive_lease.rb | |
parent | 66d5d9229de499455ca1c28f1718cec456884685 (diff) |
Remove unnecessary random key
Diffstat (limited to 'lib/gitlab/exclusive_lease.rb')
-rw-r--r-- | lib/gitlab/exclusive_lease.rb | 8 |
1 files changed, 1 insertions, 7 deletions
diff --git a/lib/gitlab/exclusive_lease.rb b/lib/gitlab/exclusive_lease.rb index 8bf6f13b99d..324e32a5c68 100644 --- a/lib/gitlab/exclusive_lease.rb +++ b/lib/gitlab/exclusive_lease.rb @@ -1,5 +1,3 @@ -require 'securerandom' - module Gitlab # This class implements an 'exclusive lease'. We call it a 'lease' # because it has a set expiry time. We call it 'exclusive' because only @@ -27,7 +25,7 @@ module Gitlab def try_obtain # This is expected to be atomic because we are talking to a # single-threaded Redis server. - !!redis.set(redis_key, redis_value, nx: true, ex: @timeout) + !!redis.set(redis_key, '1', nx: true, ex: @timeout) end private @@ -40,9 +38,5 @@ module Gitlab def redis_key "gitlab:exclusive_lease:#{@key}" end - - def redis_value - @redis_value ||= SecureRandom.hex(10) - end end end |