suo 0.3.1 → 0.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +6 -3
- data/.travis.yml +1 -0
- data/CHANGELOG.md +4 -0
- data/lib/suo/client/base.rb +4 -4
- data/lib/suo/version.rb +1 -1
- data/test/client_test.rb +6 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 20c696b1f0967a3f064e80bb245266608465aa17
|
4
|
+
data.tar.gz: f5da2c07382f9a0ce9779e13cd508d0044d8f4c1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8651a6d683fea5f48b89fbd1d7d101b8627a7475bc9ac17dfe4d1c48c2725a4d28428661ab05682b13721c694343960574cfde5511ce4f1e79812ec078b2a4f6
|
7
|
+
data.tar.gz: 274fe4e9a3d2048e33276502c15fe9cee6e33e2fbaeec59e70845e8a0783d1df6cbf5cbab7883e9cc2b3be36d885bb03f8cae0276537f4e5bb83134555cd67be
|
data/.rubocop.yml
CHANGED
@@ -74,7 +74,7 @@ Style/SpaceInsideBrackets:
|
|
74
74
|
Style/AndOr:
|
75
75
|
Enabled: false
|
76
76
|
|
77
|
-
Style/
|
77
|
+
Style/TrailingCommaInLiteral:
|
78
78
|
Enabled: true
|
79
79
|
|
80
80
|
Style/SpaceBeforeComma:
|
@@ -98,7 +98,7 @@ Style/SpaceAfterColon:
|
|
98
98
|
Style/SpaceAfterComma:
|
99
99
|
Enabled: true
|
100
100
|
|
101
|
-
Style/
|
101
|
+
Style/SpaceAroundKeyword:
|
102
102
|
Enabled: true
|
103
103
|
|
104
104
|
Style/SpaceAfterNot:
|
@@ -163,7 +163,7 @@ Style/StringLiterals:
|
|
163
163
|
EnforcedStyle: double_quotes
|
164
164
|
|
165
165
|
Metrics/CyclomaticComplexity:
|
166
|
-
Max:
|
166
|
+
Max: 10
|
167
167
|
|
168
168
|
Metrics/LineLength:
|
169
169
|
Max: 128
|
@@ -214,3 +214,6 @@ Metrics/ParameterLists:
|
|
214
214
|
|
215
215
|
Metrics/PerceivedComplexity:
|
216
216
|
Enabled: false
|
217
|
+
|
218
|
+
Style/Documentation:
|
219
|
+
Enabled: false
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/lib/suo/client/base.rb
CHANGED
@@ -26,8 +26,8 @@ module Suo
|
|
26
26
|
super() # initialize Monitor mixin for thread safety
|
27
27
|
end
|
28
28
|
|
29
|
-
def lock
|
30
|
-
token = acquire_lock
|
29
|
+
def lock(custom_token = nil)
|
30
|
+
token = acquire_lock(custom_token)
|
31
31
|
|
32
32
|
if block_given? && token
|
33
33
|
begin
|
@@ -95,8 +95,8 @@ module Suo
|
|
95
95
|
|
96
96
|
attr_accessor :retry_count
|
97
97
|
|
98
|
-
def acquire_lock
|
99
|
-
token
|
98
|
+
def acquire_lock(token = nil)
|
99
|
+
token ||= SecureRandom.base64(16)
|
100
100
|
|
101
101
|
retry_with_timeout do
|
102
102
|
val, cas = get
|
data/lib/suo/version.rb
CHANGED
data/test/client_test.rb
CHANGED
@@ -31,6 +31,12 @@ module ClientTests
|
|
31
31
|
assert_equal false, locked
|
32
32
|
end
|
33
33
|
|
34
|
+
def test_lock_with_custom_token
|
35
|
+
token = 'foo-bar'
|
36
|
+
lock = @client.lock token
|
37
|
+
assert_equal lock, token
|
38
|
+
end
|
39
|
+
|
34
40
|
def test_empty_lock_on_invalid_data
|
35
41
|
@client.send(:initial_set, "bad value")
|
36
42
|
assert_equal false, @client.locked?
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: suo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nick Elser
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-10-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dalli
|
@@ -170,7 +170,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
170
170
|
version: '0'
|
171
171
|
requirements: []
|
172
172
|
rubyforge_project:
|
173
|
-
rubygems_version: 2.
|
173
|
+
rubygems_version: 2.5.1
|
174
174
|
signing_key:
|
175
175
|
specification_version: 4
|
176
176
|
summary: Distributed locks (mutexes & semaphores) using Memcached or Redis.
|