redlock 1.3.1 → 1.3.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- 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
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-10-
|
11
|
+
date: 2022-10-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis
|