redlock 1.3.0 → 1.3.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +7 -7
- data/lib/redlock/client.rb +0 -2
- data/lib/redlock/version.rb +1 -1
- data/spec/client_spec.rb +7 -5
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7de9b6b9d70bce2578e474bdfe8dfa15c22bb57e0c876ac7127d826a5b6ba9b4
|
4
|
+
data.tar.gz: c294d219107aa4a8682ba4ff303e150497ea61b2dd4abb71d3cac15e78c218bd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b0eeead2b1307f12487603d72a7a5e00d6aba1d697a5327ac484a4fa4cc00575e0fcedd43a38aa34ee93da7322550630ad3cec158a5ef0fcf98849033c90ec85
|
7
|
+
data.tar.gz: 712d3c40ab8c4278f4649f373bfcb6ca4eeb2361461a48ad42d17f44a9d1becba460b82ed99f6b035232698267ad5046831230960b47171d9fa09d9ba0d4b692
|
data/Gemfile.lock
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
redlock (1.
|
4
|
+
redlock (1.3.2)
|
5
5
|
redis (>= 3.0.0, < 6.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
connection_pool (2.
|
10
|
+
connection_pool (2.3.0)
|
11
11
|
coveralls (0.8.23)
|
12
12
|
json (>= 1.8, < 3)
|
13
13
|
simplecov (~> 0.16.1)
|
@@ -18,9 +18,9 @@ GEM
|
|
18
18
|
docile (1.4.0)
|
19
19
|
json (2.3.1)
|
20
20
|
rake (13.0.6)
|
21
|
-
redis (5.0.
|
22
|
-
redis-client (
|
23
|
-
redis-client (0.
|
21
|
+
redis (5.0.5)
|
22
|
+
redis-client (>= 0.9.0)
|
23
|
+
redis-client (0.10.0)
|
24
24
|
connection_pool
|
25
25
|
rspec (3.11.0)
|
26
26
|
rspec-core (~> 3.11.0)
|
@@ -28,13 +28,13 @@ GEM
|
|
28
28
|
rspec-mocks (~> 3.11.0)
|
29
29
|
rspec-core (3.11.0)
|
30
30
|
rspec-support (~> 3.11.0)
|
31
|
-
rspec-expectations (3.11.
|
31
|
+
rspec-expectations (3.11.1)
|
32
32
|
diff-lcs (>= 1.2.0, < 2.0)
|
33
33
|
rspec-support (~> 3.11.0)
|
34
34
|
rspec-mocks (3.11.1)
|
35
35
|
diff-lcs (>= 1.2.0, < 2.0)
|
36
36
|
rspec-support (~> 3.11.0)
|
37
|
-
rspec-support (3.11.
|
37
|
+
rspec-support (3.11.1)
|
38
38
|
simplecov (0.16.1)
|
39
39
|
docile (~> 1.1)
|
40
40
|
json (>= 1.8, < 3)
|
data/lib/redlock/client.rb
CHANGED
@@ -170,8 +170,6 @@ module Redlock
|
|
170
170
|
recover_from_script_flush do
|
171
171
|
@redis.with { |conn| conn.evalsha Scripts::LOCK_SCRIPT_SHA, keys: [resource], argv: [val, ttl, allow_new_lock] }
|
172
172
|
end
|
173
|
-
rescue Redis::BaseConnectionError
|
174
|
-
false
|
175
173
|
end
|
176
174
|
|
177
175
|
def unlock(resource, val)
|
data/lib/redlock/version.rb
CHANGED
data/spec/client_spec.rb
CHANGED
@@ -242,14 +242,14 @@ RSpec.describe Redlock::Client do
|
|
242
242
|
end
|
243
243
|
|
244
244
|
context 'when a server goes away' do
|
245
|
-
it '
|
246
|
-
#
|
245
|
+
it 'raises an error on connection issues' do
|
246
|
+
# Set lock manager to a (hopefully) non-existent Redis URL to test error
|
247
247
|
redis_instance = lock_manager.instance_variable_get(:@servers).first
|
248
248
|
redis_instance.instance_variable_set(:@redis, unreachable_redis)
|
249
249
|
|
250
250
|
expect {
|
251
|
-
|
252
|
-
}.
|
251
|
+
lock_manager.lock(resource_key, ttl)
|
252
|
+
}.to raise_error(Redis::CannotConnectError)
|
253
253
|
end
|
254
254
|
end
|
255
255
|
|
@@ -259,7 +259,9 @@ RSpec.describe Redlock::Client do
|
|
259
259
|
redis_instance = lock_manager.instance_variable_get(:@servers).first
|
260
260
|
old_redis = redis_instance.instance_variable_get(:@redis)
|
261
261
|
redis_instance.instance_variable_set(:@redis, unreachable_redis)
|
262
|
-
expect
|
262
|
+
expect {
|
263
|
+
lock_manager.lock(resource_key, ttl)
|
264
|
+
}.to raise_error(Redis::CannotConnectError)
|
263
265
|
redis_instance.instance_variable_set(:@redis, old_redis)
|
264
266
|
expect(lock_manager.lock(resource_key, ttl)).to be_truthy
|
265
267
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redlock
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Leandro Moreira
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-10-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis
|