redlock 2.0.5 → 2.0.6

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: 7672717848770741429fd13a59ea4b6a6f734ffd8b519a9c3e27c5562f553cec
4
- data.tar.gz: 627314f12eaf57b1e44bde9cfe2388716705c93b27f95479aa5c70553b3c754b
3
+ metadata.gz: 9dd90bf121367947d80385e0e24ec5aabe59e0e5452ee0d6dc7904fbd0a93fc7
4
+ data.tar.gz: d42662fb6a39139c47a9b0eff70efcdf5f59c067a1ab9d2205d0d881a94f2a73
5
5
  SHA512:
6
- metadata.gz: 31b8beb93afa3cd62e741637aa221b71522810a8df54d33ea54874eed7d8fac894da1622f97528704027b870dd7945bdb53dd7424fbfb47c47430f6f659d2a90
7
- data.tar.gz: 3602f85cafd155cdaef70499231a0885f1df13f58abc1859c526d11f43ea303a2ee746928166002b5495e53b5ce8fa84700d76c583463bed3adef25da263c5d8
6
+ metadata.gz: 3461e69ab931dd23bb5cf7a6d6d819a0fecf76eccb62a37e058e27a40780a5a9141f56b3d274ca94e4e51dd3edd9cd0c767ed8b3b2d6d6c33a5590d7b4531136
7
+ data.tar.gz: e29da6290a7192dc20ed68171c793a8b682a8849ecced7fab68d72a289f033661296846f4c908a82579a43bb5dbfa51cdd5392bef8ef728eaca5f4275d61addd
@@ -319,7 +319,8 @@ module Redlock
319
319
  @servers.each { |s| s.unlock(resource, value) }
320
320
 
321
321
  if errors.size >= @quorum
322
- raise LockAcquisitionError.new('Too many Redis errors prevented lock acquisition', errors)
322
+ err_msgs = errors.map { |e| "#{e.class}: #{e.message}" }.join("\n")
323
+ raise LockAcquisitionError.new("Too many Redis errors prevented lock acquisition:\n#{err_msgs}", errors)
323
324
  end
324
325
 
325
326
  false
@@ -1,3 +1,3 @@
1
1
  module Redlock
2
- VERSION = '2.0.5'
2
+ VERSION = '2.0.6'
3
3
  end
data/spec/client_spec.rb CHANGED
@@ -108,9 +108,19 @@ RSpec.describe Redlock::Client do
108
108
  it 'fails to acquire a lock if majority of Redis instances are not available' do
109
109
  redlock = Redlock::Client.new(servers_without_quorum)
110
110
 
111
+ expected_msg = <<~MSG
112
+ failed to acquire lock on 'Too many Redis errors prevented lock acquisition:
113
+ RedisClient::CannotConnectError: Connection refused - connect(2) for 127.0.0.1:46864
114
+ RedisClient::CannotConnectError: Connection refused - connect(2) for 127.0.0.1:46864'
115
+ MSG
116
+
111
117
  expect {
112
118
  redlock.lock(resource_key, ttl)
113
- }.to raise_error(Redlock::LockAcquisitionError)
119
+ }.to raise_error do |error|
120
+ expect(error).to be_a(Redlock::LockAcquisitionError)
121
+ expect(error.message).to eq(expected_msg.chomp)
122
+ expect(error.errors.size).to eq(2)
123
+ end
114
124
  end
115
125
  end
116
126
 
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: 2.0.5
4
+ version: 2.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leandro Moreira
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-10-28 00:00:00.000000000 Z
11
+ date: 2023-10-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis-client