Merge pull request #5 from keylimetoolbox/double-initial-set

Fix #initial_set which is causing a double attempt and delay on lock acquisition and incorrect drop on short acquisition_timeout
This commit is contained in:
Nick Elser
2018-10-05 13:28:16 -07:00
committed by GitHub
3 changed files with 6 additions and 9 deletions

View File

@@ -56,10 +56,7 @@ module Suo
retry_with_timeout do
val, cas = get
if val.nil?
initial_set
next
end
cas = initial_set if val.nil?
cleared_locks = deserialize_and_clear_locks(val)
@@ -102,10 +99,7 @@ module Suo
retry_with_timeout do
val, cas = get
if val.nil?
initial_set
next
end
cas = initial_set if val.nil?
cleared_locks = deserialize_and_clear_locks(val)

View File

@@ -26,6 +26,8 @@ module Suo
def initial_set(val = BLANK_STR)
@client.set(@key, val)
_val, cas = @client.get_cas(@key)
cas
end
end
end

View File

@@ -39,7 +39,8 @@ module Suo
end
def initial_set(val = BLANK_STR)
@client.set(@key, val)
set(val, nil)
nil
end
end
end