tiny code style improvements

This commit is contained in:
Nick Elser
2015-04-13 21:55:34 -07:00
parent 155a3ac40c
commit 498073b92e

View File

@@ -87,7 +87,6 @@ module Suo
private private
def acquire_lock(key, resources = 1) def acquire_lock(key, resources = 1)
acquisition_token = nil
token = SecureRandom.base64(16) token = SecureRandom.base64(16)
retry_with_timeout(key) do retry_with_timeout(key) do
@@ -105,14 +104,11 @@ module Suo
newval = serialize_locks(cleared_locks) newval = serialize_locks(cleared_locks)
if set(key, newval, cas) return token if set(key, newval, cas)
acquisition_token = token
break
end
end end
end end
acquisition_token nil
end end
def get(key) # rubocop:disable Lint/UnusedMethodArgument def get(key) # rubocop:disable Lint/UnusedMethodArgument
@@ -135,8 +131,8 @@ module Suo
start = Time.now.to_f start = Time.now.to_f
@retry_count.times do @retry_count.times do
now = Time.now.to_f elapsed = Time.now.to_f - start
break if now - start > @options[:acquisition_timeout] break if elapsed >= @options[:acquisition_timeout]
synchronize(key) do synchronize(key) do
yield yield