mirror of
https://github.com/dkam/suo.git
synced 2025-01-29 07:42:43 +00:00
some style fixes
This commit is contained in:
@@ -49,7 +49,7 @@ module Suo
|
|||||||
val, cas = get(key)
|
val, cas = get(key)
|
||||||
|
|
||||||
if val.nil?
|
if val.nil?
|
||||||
set_initial(key)
|
initial_set(key)
|
||||||
next
|
next
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -94,7 +94,7 @@ module Suo
|
|||||||
val, cas = get(key)
|
val, cas = get(key)
|
||||||
|
|
||||||
if val.nil?
|
if val.nil?
|
||||||
set_initial(key)
|
initial_set(key)
|
||||||
next
|
next
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -123,7 +123,7 @@ module Suo
|
|||||||
fail NotImplementedError
|
fail NotImplementedError
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_initial(key) # rubocop:disable Lint/UnusedMethodArgument
|
def initial_set(key) # rubocop:disable Lint/UnusedMethodArgument
|
||||||
fail NotImplementedError
|
fail NotImplementedError
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ module Suo
|
|||||||
@client.set_cas(key, newval, cas)
|
@client.set_cas(key, newval, cas)
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_initial(key)
|
def initial_set(key)
|
||||||
@client.set(key, "")
|
@client.set(key, "")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -32,7 +32,7 @@ module Suo
|
|||||||
@client.unwatch
|
@client.unwatch
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_initial(key)
|
def initial_set(key)
|
||||||
@client.set(key, "")
|
@client.set(key, "")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ module ClientTests
|
|||||||
ret.sort!
|
ret.sort!
|
||||||
|
|
||||||
assert_equal 0, output.size
|
assert_equal 0, output.size
|
||||||
assert_equal ["One", "Two"], ret
|
assert_equal %w(One Two), ret
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_block_multiple_resource_locking
|
def test_block_multiple_resource_locking
|
||||||
@@ -98,7 +98,7 @@ module ClientTests
|
|||||||
|
|
||||||
100.times.map do |i|
|
100.times.map do |i|
|
||||||
Thread.new do
|
Thread.new do
|
||||||
success = @client.lock(TEST_KEY, 50) do
|
success = client.lock(TEST_KEY, 50) do
|
||||||
sleep(3)
|
sleep(3)
|
||||||
success_counter << i
|
success_counter << i
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -6,4 +6,3 @@ require "minitest/autorun"
|
|||||||
require "minitest/benchmark"
|
require "minitest/benchmark"
|
||||||
|
|
||||||
ENV["SUO_TEST"] = "true"
|
ENV["SUO_TEST"] = "true"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user