mirror of
https://github.com/dkam/suo.git
synced 2025-01-29 07:42:43 +00:00
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:
@@ -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)
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -39,7 +39,8 @@ module Suo
|
||||
end
|
||||
|
||||
def initial_set(val = BLANK_STR)
|
||||
@client.set(@key, val)
|
||||
set(val, nil)
|
||||
nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user