redlock 0.2.1 → 0.2.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
  SHA1:
3
- metadata.gz: 8e34b717846f5f8faa005ab9a8d5cac3c3ea865e
4
- data.tar.gz: f7a615768b2fc2746d16128122a69259c252b78f
3
+ metadata.gz: 70744bd95881adacc0fc6623a3ba75ee0840339e
4
+ data.tar.gz: 3b5b971c30395079d645eab57504ba002b7bed61
5
5
  SHA512:
6
- metadata.gz: ced9a5040b0fe2b0d2ea947732495c06a647b8df04cb5cda89b3f82731d76f79446afda7dd86d21b6705c67f6ccfc42f5c44fa16b753d09abd242d590172fe63
7
- data.tar.gz: 0ce3c67e5f9b81d2f8381daf9708c728f8ceaa6a3367e3153586c4621748ffcef717595333b184e7da08932be7e023dfab549b78040d064b079d762a173e800b
6
+ metadata.gz: 3e468fb7a3a98f4cb896a8d6ac6bed4ed25574ae20b6bd9f66c478674f8a3346404dcfc063bc82e74c1669e3e5402f8b1423e381c6e520073baf652b38ef69b1
7
+ data.tar.gz: 91506cfd3c6913f84cb50ce243ad13e4b9c4593a093872f83ac9518227ca477416f022b564f4aaa9004dab6c6f083614934283f58219b0970aa0cb33140d27f7
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- redlock (0.2.1)
4
+ redlock (0.2.2)
5
5
  redis (>= 3.0.0, < 5.0)
6
6
 
7
7
  GEM
@@ -163,7 +163,7 @@ module Redlock
163
163
  end
164
164
 
165
165
  def lock_instances(resource, ttl, options)
166
- value = options.fetch(:extend, { value: SecureRandom.uuid })[:value]
166
+ value = (options[:extend] || { value: SecureRandom.uuid })[:value]
167
167
  allow_new_lock = (options[:extend_life] || options[:extend_only_if_life]) ? 'no' : 'yes'
168
168
 
169
169
  locked, time_elapsed = timed do
@@ -1,3 +1,3 @@
1
1
  module Redlock
2
- VERSION = '0.2.1'
2
+ VERSION = '0.2.2'
3
3
  end
@@ -49,6 +49,14 @@ RSpec.describe Redlock::Client do
49
49
  expect(@lock_info[:value]).to eq(my_lock_info[:value])
50
50
  end
51
51
 
52
+ context 'when extend param is nil' do
53
+ it 'defaults to creating a new lock' do
54
+ @lock_info = lock_manager.lock(resource_key, ttl, extend: nil)
55
+ expect(@lock_info).to be_lock_info_for(resource_key)
56
+ expect(@lock_info[:value]).to be
57
+ end
58
+ end
59
+
52
60
  context 'when extend_only_if_life flag is given' do
53
61
  it 'does not extend a non-existent lock' do
54
62
  @lock_info = lock_manager.lock(resource_key, ttl, extend: {value: 'hello world'}, extend_only_if_life: true)
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: 0.2.1
4
+ version: 0.2.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: 2017-11-15 00:00:00.000000000 Z
11
+ date: 2017-12-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: redis
@@ -131,7 +131,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
131
131
  version: '0'
132
132
  requirements: []
133
133
  rubyforge_project:
134
- rubygems_version: 2.5.1
134
+ rubygems_version: 2.5.2.1
135
135
  signing_key:
136
136
  specification_version: 4
137
137
  summary: Distributed lock using Redis written in Ruby.