shoryuken 3.3.0 → 3.3.1

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
- SHA256:
3
- metadata.gz: 68aa225742d398731903e759938a4c3a8ae662ab6a0846b91252a9a381f29bd5
4
- data.tar.gz: 0e93f5155fbfeef146adb1f9e26b9943c0e60da6b314b1d1b5f507adcbbbed10
2
+ SHA1:
3
+ metadata.gz: 52e12e226493b5e6bd3b03fe20e72704be91e0a3
4
+ data.tar.gz: 01307631f8faa8eaec721440afd52ce5fabde0b5
5
5
  SHA512:
6
- metadata.gz: f7b70803c03bf5aebc3215f0b2f6b4275bd56e738bf10133b9c67ae0a3675335eee1bd818b38667cec4ea6c5b57032a6ab35a2fe6cc5d336d2247ea30b4cdc1e
7
- data.tar.gz: a874aaa3f126760d6ac6b95c9e32bd97a6aa173bb3e8a1a4064084d10fc88883d0ec2e5e8e0cee57b27f70d3225cc62ad4317735d76df2f19ee349886eefc720
6
+ metadata.gz: f9d451c4a642436008d1cdf60edd78d8e251fa56cc8ddc455792a85a997eb2acc601ff8a7743f3bfb5cfeadac5c8a9059490df63b5a2ec1dae3174eb4f868fd5
7
+ data.tar.gz: 9da2205a92ff6f92ce6befc0c61de49aa174529d5b704329341dd47e4aaa0a48288678d729c6b3f32695a46560136c5cfc230e7204316d6b9c759972a7a14d36
@@ -1,3 +1,8 @@
1
+ ## [v3.3.1] - 2018-10-30
2
+
3
+ - Memoization of boolean causes extra calls to SQS
4
+ - [#529](https://github.com/phstc/shoryuken/pull/529)
5
+
1
6
  ## [v3.3.0] - 2018-09-30
2
7
 
3
8
  - Add support for TSTP
@@ -44,7 +44,10 @@ module Shoryuken
44
44
  end
45
45
 
46
46
  def fifo?
47
- @_fifo ||= queue_attributes.attributes[FIFO_ATTR] == 'true'
47
+ # Make sure the memoization work with boolean to avoid multiple calls to SQS
48
+ # see https://github.com/phstc/shoryuken/pull/529
49
+ return @_fifo if defined?(@_fifo)
50
+ @_fifo = queue_attributes.attributes[FIFO_ATTR] == 'true'
48
51
  end
49
52
 
50
53
  private
@@ -1,3 +1,3 @@
1
1
  module Shoryuken
2
- VERSION = '3.3.0'.freeze
2
+ VERSION = '3.3.1'.freeze
3
3
  end
@@ -193,9 +193,8 @@ RSpec.describe Shoryuken::Queue do
193
193
  end
194
194
 
195
195
  describe '#fifo?' do
196
+ let(:attribute_response) { double 'Aws::SQS::Types::GetQueueAttributesResponse' }
196
197
  before do
197
- attribute_response = double 'Aws::SQS::Types::GetQueueAttributesResponse'
198
-
199
198
  allow(attribute_response).to(
200
199
  receive(:attributes).and_return('FifoQueue' => fifo.to_s, 'ContentBasedDeduplication' => 'true')
201
200
  )
@@ -209,12 +208,30 @@ RSpec.describe Shoryuken::Queue do
209
208
  let(:fifo) { true }
210
209
 
211
210
  specify { expect(subject.fifo?).to be }
211
+
212
+ it 'memoizes response' do
213
+ expect(sqs).to(
214
+ receive(:get_queue_attributes).with(queue_url: queue_url, attribute_names: ['All']).and_return(attribute_response)
215
+ ).exactly(1).times
216
+
217
+ subject.fifo?
218
+ subject.fifo?
219
+ end
212
220
  end
213
221
 
214
222
  context 'when queue is not FIFO' do
215
223
  let(:fifo) { false }
216
224
 
217
225
  specify { expect(subject.fifo?).to_not be }
226
+
227
+ it 'memoizes response' do
228
+ expect(sqs).to(
229
+ receive(:get_queue_attributes).with(queue_url: queue_url, attribute_names: ['All']).and_return(attribute_response)
230
+ ).exactly(1).times
231
+
232
+ subject.fifo?
233
+ subject.fifo?
234
+ end
218
235
  end
219
236
  end
220
237
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shoryuken
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.3.0
4
+ version: 3.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Pablo Cantero
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-01 00:00:00.000000000 Z
11
+ date: 2018-10-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -228,7 +228,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
228
228
  version: '0'
229
229
  requirements: []
230
230
  rubyforge_project:
231
- rubygems_version: 2.7.3
231
+ rubygems_version: 2.5.2
232
232
  signing_key:
233
233
  specification_version: 4
234
234
  summary: Shoryuken is a super efficient AWS SQS thread based message processor