shoryuken 5.0.0 → 5.1.0
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 +4 -4
- data/.github/FUNDING.yml +12 -0
- data/.github/workflows/specs.yml +57 -0
- data/.reek.yml +5 -0
- data/.rubocop.yml +3 -6
- data/Appraisals +28 -0
- data/CHANGELOG.md +49 -0
- data/Gemfile +3 -1
- data/README.md +19 -3
- data/Rakefile +3 -0
- data/bin/cli/sqs.rb +9 -1
- data/gemfiles/.gitignore +1 -0
- data/gemfiles/rails_4_2.gemfile +20 -0
- data/gemfiles/rails_5_2.gemfile +21 -0
- data/gemfiles/rails_6_0.gemfile +21 -0
- data/gemfiles/rails_6_1.gemfile +21 -0
- data/lib/shoryuken/default_worker_registry.rb +1 -1
- data/lib/shoryuken/environment_loader.rb +5 -13
- data/lib/shoryuken/extensions/active_job_adapter.rb +21 -16
- data/lib/shoryuken/extensions/active_job_concurrent_send_adapter.rb +50 -0
- data/lib/shoryuken/extensions/active_job_extensions.rb +37 -0
- data/lib/shoryuken/manager.rb +10 -4
- data/lib/shoryuken/options.rb +5 -3
- data/lib/shoryuken/polling/base.rb +2 -0
- data/lib/shoryuken/polling/strict_priority.rb +6 -0
- data/lib/shoryuken/polling/weighted_round_robin.rb +11 -0
- data/lib/shoryuken/queue.rb +39 -11
- data/lib/shoryuken/version.rb +1 -1
- data/lib/shoryuken.rb +5 -1
- data/shoryuken.gemspec +0 -1
- data/spec/shared_examples_for_active_job.rb +279 -0
- data/spec/shoryuken/environment_loader_spec.rb +24 -0
- data/spec/shoryuken/extensions/active_job_adapter_spec.rb +2 -59
- data/spec/shoryuken/extensions/active_job_base_spec.rb +73 -0
- data/spec/shoryuken/extensions/active_job_concurrent_send_adapter_spec.rb +35 -0
- data/spec/shoryuken/manager_spec.rb +24 -0
- data/spec/shoryuken/options_spec.rb +18 -0
- data/spec/shoryuken/polling/strict_priority_spec.rb +10 -0
- data/spec/shoryuken/polling/weighted_round_robin_spec.rb +10 -0
- data/spec/shoryuken/queue_spec.rb +23 -0
- data/spec/spec_helper.rb +6 -6
- metadata +23 -22
- data/.travis.yml +0 -34
|
@@ -3,6 +3,24 @@ require 'spec_helper'
|
|
|
3
3
|
RSpec.describe Shoryuken::Options do
|
|
4
4
|
subject { Shoryuken.shoryuken_options }
|
|
5
5
|
|
|
6
|
+
describe '.on_stop' do
|
|
7
|
+
specify do
|
|
8
|
+
on_stop = Proc.new {}
|
|
9
|
+
Shoryuken.on_stop(&on_stop)
|
|
10
|
+
|
|
11
|
+
expect(Shoryuken.stop_callback).to eq(on_stop)
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
describe '.on_start' do
|
|
16
|
+
specify do
|
|
17
|
+
on_start = Proc.new {}
|
|
18
|
+
Shoryuken.on_start(&on_start)
|
|
19
|
+
|
|
20
|
+
expect(Shoryuken.start_callback).to eq(on_start)
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
6
24
|
describe '.add_group adds queues and optional delay' do
|
|
7
25
|
before do
|
|
8
26
|
Shoryuken.groups.clear
|
|
@@ -145,4 +145,14 @@ RSpec.describe Shoryuken::Polling::StrictPriority do
|
|
|
145
145
|
expect(subject.next_queue).to eq(queue3)
|
|
146
146
|
end
|
|
147
147
|
end
|
|
148
|
+
|
|
149
|
+
describe '#message_processed' do
|
|
150
|
+
it 'removes paused queue, adds to active queues' do
|
|
151
|
+
strategy = Shoryuken::Polling::StrictPriority.new([queue1, queue2])
|
|
152
|
+
strategy.send(:pause, queue1)
|
|
153
|
+
expect(strategy.active_queues).to eq([[queue2, 1]])
|
|
154
|
+
strategy.message_processed(queue1)
|
|
155
|
+
expect(strategy.active_queues).to eq([[queue1, 2], [queue2, 1]])
|
|
156
|
+
end
|
|
157
|
+
end
|
|
148
158
|
end
|
|
@@ -104,4 +104,14 @@ RSpec.describe Shoryuken::Polling::WeightedRoundRobin do
|
|
|
104
104
|
expect(subject.delay).to eq(1.0)
|
|
105
105
|
end
|
|
106
106
|
end
|
|
107
|
+
|
|
108
|
+
describe '#message_processed' do
|
|
109
|
+
it 'removes paused queue, adds to active queues' do
|
|
110
|
+
strategy = Shoryuken::Polling::WeightedRoundRobin.new([queue1, queue2])
|
|
111
|
+
strategy.send(:pause, queue1)
|
|
112
|
+
expect(strategy.active_queues).to eq([[queue2, 1]])
|
|
113
|
+
strategy.message_processed(queue1)
|
|
114
|
+
expect(strategy.active_queues).to eq([[queue2, 1], [queue1, 1]])
|
|
115
|
+
end
|
|
116
|
+
end
|
|
107
117
|
end
|
|
@@ -39,6 +39,29 @@ RSpec.describe Shoryuken::Queue do
|
|
|
39
39
|
end
|
|
40
40
|
end
|
|
41
41
|
|
|
42
|
+
context 'when queue ARN supplied' do
|
|
43
|
+
let(:queue_arn) { 'arn:aws:sqs:ap-southeast-2:000000000000:queue-name' }
|
|
44
|
+
|
|
45
|
+
it 'initializes by URL and validate the URL' do
|
|
46
|
+
subject = described_class.new(sqs, queue_arn)
|
|
47
|
+
|
|
48
|
+
expect(subject.name).to eq('queue-name')
|
|
49
|
+
expect(subject.url).to eq('https://sqs.ap-southeast-2.amazonaws.com/000000000000/queue-name')
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
|
|
53
|
+
context 'when invalid queue ARN supplied' do
|
|
54
|
+
let(:queue_arn) { 'arn:aws:sqs::000000000000:queue-name' }
|
|
55
|
+
|
|
56
|
+
it 'raises an error' do
|
|
57
|
+
expect do
|
|
58
|
+
described_class.new(sqs, queue_arn)
|
|
59
|
+
end.to raise_error(
|
|
60
|
+
'Invalid ARN: arn:aws:sqs::000000000000:queue-name. A valid ARN must include: region, account_id and resource.'
|
|
61
|
+
)
|
|
62
|
+
end
|
|
63
|
+
end
|
|
64
|
+
|
|
42
65
|
context 'when queue name supplied' do
|
|
43
66
|
subject { described_class.new(sqs, queue_name) }
|
|
44
67
|
|
data/spec/spec_helper.rb
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
require 'bundler/setup'
|
|
2
2
|
Bundler.setup
|
|
3
3
|
|
|
4
|
-
|
|
4
|
+
begin
|
|
5
|
+
require 'pry-byebug'
|
|
6
|
+
rescue LoadError
|
|
7
|
+
end
|
|
8
|
+
|
|
5
9
|
require 'shoryuken'
|
|
6
10
|
require 'json'
|
|
7
11
|
require 'dotenv'
|
|
@@ -28,11 +32,7 @@ class TestWorker
|
|
|
28
32
|
end
|
|
29
33
|
|
|
30
34
|
RSpec.configure do |config|
|
|
31
|
-
#
|
|
32
|
-
# The AWS_ACCESS_KEY_ID checker is because Travis CI
|
|
33
|
-
# does not expose ENV variables to pull requests from forked repositories
|
|
34
|
-
# http://docs.travis-ci.com/user/pull-requests/
|
|
35
|
-
# config.filter_run_excluding slow: true if ENV['SPEC_ALL'] != 'true' || ENV['AWS_ACCESS_KEY_ID'].nil?
|
|
35
|
+
# TODO: Run these tests again on CI
|
|
36
36
|
config.filter_run_excluding slow: true
|
|
37
37
|
|
|
38
38
|
config.before do
|
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: 5.
|
|
4
|
+
version: 5.1.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Pablo Cantero
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2021-02-07 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: dotenv
|
|
@@ -24,20 +24,6 @@ dependencies:
|
|
|
24
24
|
- - ">="
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
26
|
version: '0'
|
|
27
|
-
- !ruby/object:Gem::Dependency
|
|
28
|
-
name: pry-byebug
|
|
29
|
-
requirement: !ruby/object:Gem::Requirement
|
|
30
|
-
requirements:
|
|
31
|
-
- - ">="
|
|
32
|
-
- !ruby/object:Gem::Version
|
|
33
|
-
version: '0'
|
|
34
|
-
type: :development
|
|
35
|
-
prerelease: false
|
|
36
|
-
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
-
requirements:
|
|
38
|
-
- - ">="
|
|
39
|
-
- !ruby/object:Gem::Version
|
|
40
|
-
version: '0'
|
|
41
27
|
- !ruby/object:Gem::Dependency
|
|
42
28
|
name: rake
|
|
43
29
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -117,10 +103,13 @@ extensions: []
|
|
|
117
103
|
extra_rdoc_files: []
|
|
118
104
|
files:
|
|
119
105
|
- ".codeclimate.yml"
|
|
106
|
+
- ".github/FUNDING.yml"
|
|
107
|
+
- ".github/workflows/specs.yml"
|
|
120
108
|
- ".gitignore"
|
|
109
|
+
- ".reek.yml"
|
|
121
110
|
- ".rspec"
|
|
122
111
|
- ".rubocop.yml"
|
|
123
|
-
-
|
|
112
|
+
- Appraisals
|
|
124
113
|
- CHANGELOG.md
|
|
125
114
|
- Gemfile
|
|
126
115
|
- Gemfile.aws-sdk-core-v2
|
|
@@ -132,6 +121,11 @@ files:
|
|
|
132
121
|
- bin/shoryuken
|
|
133
122
|
- examples/bootstrap_queues.rb
|
|
134
123
|
- examples/default_worker.rb
|
|
124
|
+
- gemfiles/.gitignore
|
|
125
|
+
- gemfiles/rails_4_2.gemfile
|
|
126
|
+
- gemfiles/rails_5_2.gemfile
|
|
127
|
+
- gemfiles/rails_6_0.gemfile
|
|
128
|
+
- gemfiles/rails_6_1.gemfile
|
|
135
129
|
- lib/shoryuken.rb
|
|
136
130
|
- lib/shoryuken/body_parser.rb
|
|
137
131
|
- lib/shoryuken/client.rb
|
|
@@ -139,6 +133,8 @@ files:
|
|
|
139
133
|
- lib/shoryuken/default_worker_registry.rb
|
|
140
134
|
- lib/shoryuken/environment_loader.rb
|
|
141
135
|
- lib/shoryuken/extensions/active_job_adapter.rb
|
|
136
|
+
- lib/shoryuken/extensions/active_job_concurrent_send_adapter.rb
|
|
137
|
+
- lib/shoryuken/extensions/active_job_extensions.rb
|
|
142
138
|
- lib/shoryuken/fetcher.rb
|
|
143
139
|
- lib/shoryuken/launcher.rb
|
|
144
140
|
- lib/shoryuken/logging.rb
|
|
@@ -166,6 +162,7 @@ files:
|
|
|
166
162
|
- shoryuken.gemspec
|
|
167
163
|
- shoryuken.jpg
|
|
168
164
|
- spec/integration/launcher_spec.rb
|
|
165
|
+
- spec/shared_examples_for_active_job.rb
|
|
169
166
|
- spec/shoryuken.yml
|
|
170
167
|
- spec/shoryuken/body_parser_spec.rb
|
|
171
168
|
- spec/shoryuken/client_spec.rb
|
|
@@ -173,6 +170,8 @@ files:
|
|
|
173
170
|
- spec/shoryuken/default_worker_registry_spec.rb
|
|
174
171
|
- spec/shoryuken/environment_loader_spec.rb
|
|
175
172
|
- spec/shoryuken/extensions/active_job_adapter_spec.rb
|
|
173
|
+
- spec/shoryuken/extensions/active_job_base_spec.rb
|
|
174
|
+
- spec/shoryuken/extensions/active_job_concurrent_send_adapter_spec.rb
|
|
176
175
|
- spec/shoryuken/fetcher_spec.rb
|
|
177
176
|
- spec/shoryuken/manager_spec.rb
|
|
178
177
|
- spec/shoryuken/middleware/chain_spec.rb
|
|
@@ -198,7 +197,7 @@ homepage: https://github.com/phstc/shoryuken
|
|
|
198
197
|
licenses:
|
|
199
198
|
- LGPL-3.0
|
|
200
199
|
metadata: {}
|
|
201
|
-
post_install_message:
|
|
200
|
+
post_install_message:
|
|
202
201
|
rdoc_options: []
|
|
203
202
|
require_paths:
|
|
204
203
|
- lib
|
|
@@ -213,13 +212,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
213
212
|
- !ruby/object:Gem::Version
|
|
214
213
|
version: '0'
|
|
215
214
|
requirements: []
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
signing_key:
|
|
215
|
+
rubygems_version: 3.0.1
|
|
216
|
+
signing_key:
|
|
219
217
|
specification_version: 4
|
|
220
218
|
summary: Shoryuken is a super efficient AWS SQS thread based message processor
|
|
221
219
|
test_files:
|
|
222
220
|
- spec/integration/launcher_spec.rb
|
|
221
|
+
- spec/shared_examples_for_active_job.rb
|
|
223
222
|
- spec/shoryuken.yml
|
|
224
223
|
- spec/shoryuken/body_parser_spec.rb
|
|
225
224
|
- spec/shoryuken/client_spec.rb
|
|
@@ -227,6 +226,8 @@ test_files:
|
|
|
227
226
|
- spec/shoryuken/default_worker_registry_spec.rb
|
|
228
227
|
- spec/shoryuken/environment_loader_spec.rb
|
|
229
228
|
- spec/shoryuken/extensions/active_job_adapter_spec.rb
|
|
229
|
+
- spec/shoryuken/extensions/active_job_base_spec.rb
|
|
230
|
+
- spec/shoryuken/extensions/active_job_concurrent_send_adapter_spec.rb
|
|
230
231
|
- spec/shoryuken/fetcher_spec.rb
|
|
231
232
|
- spec/shoryuken/manager_spec.rb
|
|
232
233
|
- spec/shoryuken/middleware/chain_spec.rb
|
data/.travis.yml
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
language: ruby
|
|
2
|
-
|
|
3
|
-
rvm:
|
|
4
|
-
- 2.0.0
|
|
5
|
-
- 2.1.10
|
|
6
|
-
- 2.2.10
|
|
7
|
-
- 2.3.8
|
|
8
|
-
- 2.4.4
|
|
9
|
-
- 2.5.1
|
|
10
|
-
- 2.6.3
|
|
11
|
-
|
|
12
|
-
notifications:
|
|
13
|
-
email:
|
|
14
|
-
on_success: change
|
|
15
|
-
on_failure: always
|
|
16
|
-
|
|
17
|
-
gemfile:
|
|
18
|
-
- Gemfile
|
|
19
|
-
- Gemfile.aws-sdk-core-v2
|
|
20
|
-
|
|
21
|
-
env:
|
|
22
|
-
- SPEC_ALL=true
|
|
23
|
-
|
|
24
|
-
script: bundle exec rspec spec
|
|
25
|
-
|
|
26
|
-
before_install:
|
|
27
|
-
- gem install bundler -v '< 2'
|
|
28
|
-
|
|
29
|
-
after_success:
|
|
30
|
-
- bundle exec codeclimate-test-reporter
|
|
31
|
-
|
|
32
|
-
addons:
|
|
33
|
-
code_climate:
|
|
34
|
-
repo_token: 7709fd21981bb9d2658647a66d959415a1029a83f1c199573828797944f26c52
|