shoryuken 5.0.4 → 5.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/specs.yml +62 -0
- data/.reek.yml +5 -0
- data/.rubocop.yml +1 -1
- data/Appraisals +36 -0
- data/CHANGELOG.md +63 -0
- data/Gemfile +3 -1
- data/README.md +24 -2
- data/Rakefile +15 -1
- data/bin/cli/sqs.rb +50 -5
- data/gemfiles/.gitignore +1 -0
- data/gemfiles/aws_sdk_core_2.gemfile +21 -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/environment_loader.rb +7 -1
- data/lib/shoryuken/extensions/active_job_adapter.rb +25 -18
- data/lib/shoryuken/extensions/active_job_extensions.rb +38 -0
- data/lib/shoryuken/launcher.rb +1 -0
- data/lib/shoryuken/manager.rb +24 -5
- data/lib/shoryuken/options.rb +1 -0
- 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 +1 -0
- data/shoryuken.gemspec +0 -1
- data/spec/integration/launcher_spec.rb +29 -2
- data/spec/shared_examples_for_active_job.rb +226 -9
- data/spec/shoryuken/environment_loader_spec.rb +22 -2
- data/spec/shoryuken/extensions/active_job_adapter_spec.rb +1 -1
- data/spec/shoryuken/extensions/active_job_base_spec.rb +84 -0
- data/spec/shoryuken/extensions/active_job_concurrent_send_adapter_spec.rb +4 -0
- data/spec/shoryuken/extensions/active_job_wrapper_spec.rb +20 -0
- data/spec/shoryuken/manager_spec.rb +35 -1
- 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 +5 -9
- metadata +20 -22
- data/.travis.yml +0 -34
- data/Gemfile.aws-sdk-core-v2 +0 -13
@@ -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,13 +32,6 @@ class TestWorker
|
|
28
32
|
end
|
29
33
|
|
30
34
|
RSpec.configure do |config|
|
31
|
-
# Only run slow tests if SPEC_ALL=true and AWS_ACCESS_KEY_ID is present
|
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?
|
36
|
-
config.filter_run_excluding slow: true
|
37
|
-
|
38
35
|
config.before do
|
39
36
|
Shoryuken::Client.class_variable_set :@@queues, {}
|
40
37
|
|
@@ -63,7 +60,6 @@ RSpec.configure do |config|
|
|
63
60
|
|
64
61
|
Shoryuken.cache_visibility_timeout = false
|
65
62
|
|
66
|
-
allow(Concurrent).to receive(:global_io_executor).and_return(Concurrent::ImmediateExecutor.new)
|
67
63
|
allow(Shoryuken).to receive(:active_job?).and_return(false)
|
68
64
|
end
|
69
65
|
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: 5.
|
4
|
+
version: 5.2.3
|
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-07-30 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
|
@@ -118,13 +104,14 @@ extra_rdoc_files: []
|
|
118
104
|
files:
|
119
105
|
- ".codeclimate.yml"
|
120
106
|
- ".github/FUNDING.yml"
|
107
|
+
- ".github/workflows/specs.yml"
|
121
108
|
- ".gitignore"
|
109
|
+
- ".reek.yml"
|
122
110
|
- ".rspec"
|
123
111
|
- ".rubocop.yml"
|
124
|
-
-
|
112
|
+
- Appraisals
|
125
113
|
- CHANGELOG.md
|
126
114
|
- Gemfile
|
127
|
-
- Gemfile.aws-sdk-core-v2
|
128
115
|
- LICENSE
|
129
116
|
- README.md
|
130
117
|
- Rakefile
|
@@ -133,6 +120,12 @@ files:
|
|
133
120
|
- bin/shoryuken
|
134
121
|
- examples/bootstrap_queues.rb
|
135
122
|
- examples/default_worker.rb
|
123
|
+
- gemfiles/.gitignore
|
124
|
+
- gemfiles/aws_sdk_core_2.gemfile
|
125
|
+
- gemfiles/rails_4_2.gemfile
|
126
|
+
- gemfiles/rails_5_2.gemfile
|
127
|
+
- gemfiles/rails_6_0.gemfile
|
128
|
+
- gemfiles/rails_6_1.gemfile
|
136
129
|
- lib/shoryuken.rb
|
137
130
|
- lib/shoryuken/body_parser.rb
|
138
131
|
- lib/shoryuken/client.rb
|
@@ -141,6 +134,7 @@ files:
|
|
141
134
|
- lib/shoryuken/environment_loader.rb
|
142
135
|
- lib/shoryuken/extensions/active_job_adapter.rb
|
143
136
|
- lib/shoryuken/extensions/active_job_concurrent_send_adapter.rb
|
137
|
+
- lib/shoryuken/extensions/active_job_extensions.rb
|
144
138
|
- lib/shoryuken/fetcher.rb
|
145
139
|
- lib/shoryuken/launcher.rb
|
146
140
|
- lib/shoryuken/logging.rb
|
@@ -176,7 +170,9 @@ files:
|
|
176
170
|
- spec/shoryuken/default_worker_registry_spec.rb
|
177
171
|
- spec/shoryuken/environment_loader_spec.rb
|
178
172
|
- spec/shoryuken/extensions/active_job_adapter_spec.rb
|
173
|
+
- spec/shoryuken/extensions/active_job_base_spec.rb
|
179
174
|
- spec/shoryuken/extensions/active_job_concurrent_send_adapter_spec.rb
|
175
|
+
- spec/shoryuken/extensions/active_job_wrapper_spec.rb
|
180
176
|
- spec/shoryuken/fetcher_spec.rb
|
181
177
|
- spec/shoryuken/manager_spec.rb
|
182
178
|
- spec/shoryuken/middleware/chain_spec.rb
|
@@ -202,7 +198,7 @@ homepage: https://github.com/phstc/shoryuken
|
|
202
198
|
licenses:
|
203
199
|
- LGPL-3.0
|
204
200
|
metadata: {}
|
205
|
-
post_install_message:
|
201
|
+
post_install_message:
|
206
202
|
rdoc_options: []
|
207
203
|
require_paths:
|
208
204
|
- lib
|
@@ -217,8 +213,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
217
213
|
- !ruby/object:Gem::Version
|
218
214
|
version: '0'
|
219
215
|
requirements: []
|
220
|
-
rubygems_version: 3.1
|
221
|
-
signing_key:
|
216
|
+
rubygems_version: 3.0.1
|
217
|
+
signing_key:
|
222
218
|
specification_version: 4
|
223
219
|
summary: Shoryuken is a super efficient AWS SQS thread based message processor
|
224
220
|
test_files:
|
@@ -231,7 +227,9 @@ test_files:
|
|
231
227
|
- spec/shoryuken/default_worker_registry_spec.rb
|
232
228
|
- spec/shoryuken/environment_loader_spec.rb
|
233
229
|
- spec/shoryuken/extensions/active_job_adapter_spec.rb
|
230
|
+
- spec/shoryuken/extensions/active_job_base_spec.rb
|
234
231
|
- spec/shoryuken/extensions/active_job_concurrent_send_adapter_spec.rb
|
232
|
+
- spec/shoryuken/extensions/active_job_wrapper_spec.rb
|
235
233
|
- spec/shoryuken/fetcher_spec.rb
|
236
234
|
- spec/shoryuken/manager_spec.rb
|
237
235
|
- 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
|
data/Gemfile.aws-sdk-core-v2
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
source 'https://rubygems.org'
|
2
|
-
|
3
|
-
# Specify your gem's dependencies in shoryuken.gemspec
|
4
|
-
gemspec
|
5
|
-
|
6
|
-
group :test do
|
7
|
-
gem 'activejob', '~> 4'
|
8
|
-
gem 'aws-sdk-core', '~> 2'
|
9
|
-
gem 'codeclimate-test-reporter', require: nil
|
10
|
-
gem 'httparty'
|
11
|
-
gem 'multi_xml'
|
12
|
-
gem 'simplecov'
|
13
|
-
end
|