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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 91ee96071b53b7710c8268b7146c1c44f77a50b1b38267ccc9c088ad2ce8ca0c
4
- data.tar.gz: 3d5adc81e331d1f971b440c14c9c8418257c7c499c8cc40a515dbc80c564dda5
3
+ metadata.gz: 7de9b6b9d70bce2578e474bdfe8dfa15c22bb57e0c876ac7127d826a5b6ba9b4
4
+ data.tar.gz: c294d219107aa4a8682ba4ff303e150497ea61b2dd4abb71d3cac15e78c218bd
5
5
  SHA512:
6
- metadata.gz: 5753c8c53fee8599cf22869200bed307d27eff4c0aeb8e5235e96dfd46fe201283cb122d9298f7cc113396a5fa141ecb6d69f2f90bb80a4e0aff4bd1ae89fa50
7
- data.tar.gz: 2fe0eb860c936c84bf37e3f77a6e8f3b83d003e30121c964d2a1a816894b48a3ce69c874982bb8973d626cab95f508a752da157def815e69133cf0a17c57dc63
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.2.2)
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.2.5)
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.1)
22
- redis-client (~> 0.7)
23
- redis-client (0.7.1)
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.0)
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.0)
37
+ rspec-support (3.11.1)
38
38
  simplecov (0.16.1)
39
39
  docile (~> 1.1)
40
40
  json (>= 1.8, < 3)
@@ -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)
@@ -1,3 +1,3 @@
1
1
  module Redlock
2
- VERSION = '1.3.0'
2
+ VERSION = '1.3.2'
3
3
  end
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 'does not raise an error on connection issues' do
246
- # We re-route the lock manager to a (hopefully) non-existent Redis URL.
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
- expect(lock_manager.lock(resource_key, ttl)).to be_falsey
252
- }.to_not raise_error
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(lock_manager.lock(resource_key, ttl)).to be_falsey
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.0
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-09-05 00:00:00.000000000 Z
11
+ date: 2022-10-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis