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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 60462ab4c54aedc9ff677baa56ef2c00a0f89ff54a47267b109a285c8ffee885
4
- data.tar.gz: e8981a2b9d3bd8ee22a286276f4a6accdda14f0f7a0f6a20c98eb79d10ba44c0
3
+ metadata.gz: 7de9b6b9d70bce2578e474bdfe8dfa15c22bb57e0c876ac7127d826a5b6ba9b4
4
+ data.tar.gz: c294d219107aa4a8682ba4ff303e150497ea61b2dd4abb71d3cac15e78c218bd
5
5
  SHA512:
6
- metadata.gz: f3bd8208f003e85332e54a45fb7450616cb15073145f15635369357c44085c0a7d85f35d5c27911b8b0fe04452db9f6312858b7df79bb087870a3cc7e8bf5a28
7
- data.tar.gz: fbd2b0dce960d0d6cdbfa36892d255d8f2af054346fda466d04de00232210444c483b1facb819c4721edcd82df1685602c1766d927e61a5cd35db4ae3605e28f
6
+ metadata.gz: b0eeead2b1307f12487603d72a7a5e00d6aba1d697a5327ac484a4fa4cc00575e0fcedd43a38aa34ee93da7322550630ad3cec158a5ef0fcf98849033c90ec85
7
+ data.tar.gz: 712d3c40ab8c4278f4649f373bfcb6ca4eeb2361461a48ad42d17f44a9d1becba460b82ed99f6b035232698267ad5046831230960b47171d9fa09d9ba0d4b692
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- redlock (1.3.1)
4
+ redlock (1.3.2)
5
5
  redis (>= 3.0.0, < 6.0)
6
6
 
7
7
  GEM
@@ -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.1'
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.1
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-14 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