Commit 3729c082 authored by Jacob Vosmaer's avatar Jacob Vosmaer

Remove unnecessary random key

parent 66d5d922
require 'securerandom'
module Gitlab module Gitlab
# This class implements an 'exclusive lease'. We call it a 'lease' # This class implements an 'exclusive lease'. We call it a 'lease'
# because it has a set expiry time. We call it 'exclusive' because only # because it has a set expiry time. We call it 'exclusive' because only
...@@ -27,7 +25,7 @@ module Gitlab ...@@ -27,7 +25,7 @@ module Gitlab
def try_obtain def try_obtain
# This is expected to be atomic because we are talking to a # This is expected to be atomic because we are talking to a
# single-threaded Redis server. # single-threaded Redis server.
!!redis.set(redis_key, redis_value, nx: true, ex: @timeout) !!redis.set(redis_key, '1', nx: true, ex: @timeout)
end end
private private
...@@ -40,9 +38,5 @@ module Gitlab ...@@ -40,9 +38,5 @@ module Gitlab
def redis_key def redis_key
"gitlab:exclusive_lease:#{@key}" "gitlab:exclusive_lease:#{@key}"
end end
def redis_value
@redis_value ||= SecureRandom.hex(10)
end
end end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment