shoryuken 3.3.1 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/shoryuken/fetcher.rb +13 -2
- data/lib/shoryuken/version.rb +1 -1
- data/spec/shoryuken/fetcher_spec.rb +17 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ca967b0796d5e97753b9d201edd7aaad2e1d5c44
|
4
|
+
data.tar.gz: 4984a4ee2243ba5d8b42bec2e0c0b68e15b92c9f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8143c4a34706093177109f9d822afc711c8c88cd51c2a64653e15b8054794327e59951fccbc5990992b7d568db3cd79a1e23a1a7ec33d7a7c29837e10534f187
|
7
|
+
data.tar.gz: 5925db2ddbd791708c59b05a59805ca711bb82c9ef059db849568f8de9fec1619d7b52eab26cced9bb7b7e713ffd11227292c4294bbf642a49e60c35096fcb5d
|
data/CHANGELOG.md
CHANGED
data/lib/shoryuken/fetcher.rb
CHANGED
@@ -47,13 +47,24 @@ module Shoryuken
|
|
47
47
|
def receive_messages(queue, limit)
|
48
48
|
options = receive_options(queue)
|
49
49
|
|
50
|
-
|
50
|
+
shoryuken_queue = Shoryuken::Client.queues(queue.name)
|
51
|
+
|
52
|
+
# For FIFO queues we want to make sure we process one message per group at the time
|
53
|
+
# if we set max_number_of_messages greater than 1,
|
54
|
+
# SQS may return more than one message for the same message group
|
55
|
+
# since Shoryuken uses threads, it will try to process more than one at once
|
56
|
+
# > The message group ID is the tag that specifies that a message belongs to a specific message group.
|
57
|
+
# > Messages that belong to the same message group are always processed one by one,
|
58
|
+
# > in a strict order relative to the message group
|
59
|
+
# > (however, messages that belong to different message groups might be processed out of order).
|
60
|
+
# > https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/using-messagegroupid-property.html
|
61
|
+
options[:max_number_of_messages] = shoryuken_queue.fifo? ? 1 : max_number_of_messages(limit, options)
|
51
62
|
options[:message_attribute_names] = %w[All]
|
52
63
|
options[:attribute_names] = %w[All]
|
53
64
|
|
54
65
|
options.merge!(queue.options)
|
55
66
|
|
56
|
-
|
67
|
+
shoryuken_queue.receive_messages(options)
|
57
68
|
end
|
58
69
|
|
59
70
|
def max_number_of_messages(limit, options)
|
data/lib/shoryuken/version.rb
CHANGED
@@ -4,7 +4,7 @@ require 'shoryuken/fetcher'
|
|
4
4
|
|
5
5
|
# rubocop:disable Metrics/BlockLength
|
6
6
|
RSpec.describe Shoryuken::Fetcher do
|
7
|
-
let(:queue) { instance_double('Shoryuken::Queue') }
|
7
|
+
let(:queue) { instance_double('Shoryuken::Queue', fifo?: false) }
|
8
8
|
let(:queue_name) { 'default' }
|
9
9
|
let(:queue_config) { Shoryuken::Polling::QueueConfiguration.new(queue_name, {}) }
|
10
10
|
let(:group) { 'default' }
|
@@ -100,5 +100,21 @@ RSpec.describe Shoryuken::Fetcher do
|
|
100
100
|
subject.fetch(queue_config, limit)
|
101
101
|
end
|
102
102
|
end
|
103
|
+
|
104
|
+
context 'when FIFO' do
|
105
|
+
let(:limit) { 10 }
|
106
|
+
let(:queue) { instance_double('Shoryuken::Queue', fifo?: true) }
|
107
|
+
|
108
|
+
it 'polls one message at the time' do
|
109
|
+
# see https://github.com/phstc/shoryuken/pull/530
|
110
|
+
|
111
|
+
allow(Shoryuken::Client).to receive(:queues).with(queue_name).and_return(queue)
|
112
|
+
expect(queue).to receive(:receive_messages).with(
|
113
|
+
max_number_of_messages: 1, attribute_names: ['All'], message_attribute_names: ['All']
|
114
|
+
).and_return([])
|
115
|
+
|
116
|
+
subject.fetch(queue_config, limit)
|
117
|
+
end
|
118
|
+
end
|
103
119
|
end
|
104
120
|
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:
|
4
|
+
version: 4.0.0
|
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-
|
11
|
+
date: 2018-11-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|