shoryuken 5.1.1 → 5.2.3
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/workflows/specs.yml +10 -5
- data/Appraisals +8 -0
- data/CHANGELOG.md +30 -0
- data/README.md +8 -2
- data/Rakefile +14 -3
- data/bin/cli/sqs.rb +50 -5
- data/gemfiles/aws_sdk_core_2.gemfile +21 -0
- data/lib/shoryuken/environment_loader.rb +2 -0
- data/lib/shoryuken/extensions/active_job_adapter.rb +4 -2
- data/lib/shoryuken/launcher.rb +1 -0
- data/lib/shoryuken/manager.rb +14 -1
- data/lib/shoryuken/options.rb +1 -0
- data/lib/shoryuken/version.rb +1 -1
- data/spec/integration/launcher_spec.rb +29 -2
- data/spec/shoryuken/environment_loader_spec.rb +22 -2
- 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 +11 -1
- data/spec/spec_helper.rb +0 -4
- metadata +5 -3
- data/Gemfile.aws-sdk-core-v2 +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0f2f8c9e8573b699391a74a70d26756e106ccf72b3df9a6fccc32b72d13ec0cd
|
4
|
+
data.tar.gz: 6a009d5a5e571da339d52a08f4ccda19f144ce06132f4a65e95fabc39aeffad4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e359eee09d82a917c4e13541a121c61f78587421a7e5977052552a4f18512eeb9a2eb720ebc8adf323d0a33fd979b37e9c059a95b5b180eda93cab5a3e034f6b
|
7
|
+
data.tar.gz: 5217287d2b7f66125852ac0b824353d934a2a8568e2dc07ca3c98f8991cad1a0dafbda87967a407bc5efaea62b1cafa85708e1ea17ccb659b2743878d079a267
|
data/.github/workflows/specs.yml
CHANGED
@@ -9,9 +9,14 @@ jobs:
|
|
9
9
|
name: All Specs
|
10
10
|
strategy:
|
11
11
|
matrix:
|
12
|
-
ruby: ['2.4
|
13
|
-
gemfile: ['Gemfile', '
|
12
|
+
ruby: ['2.4', '2.5', '2.6', '2.7', '3.0']
|
13
|
+
gemfile: ['Gemfile', 'gemfiles/aws_sdk_core_2.gemfile']
|
14
14
|
runs-on: ubuntu-20.04
|
15
|
+
services:
|
16
|
+
moto_sqs:
|
17
|
+
image: quay.io/cjlarose/moto-sqs-server:1.1.0
|
18
|
+
ports:
|
19
|
+
- 5000:5000
|
15
20
|
env:
|
16
21
|
BUNDLE_GEMFILE: ${{ matrix.gemfile }}
|
17
22
|
steps:
|
@@ -22,9 +27,9 @@ jobs:
|
|
22
27
|
ruby-version: ${{ matrix.ruby }}
|
23
28
|
bundler-cache: true
|
24
29
|
- name: Run specs
|
25
|
-
env:
|
26
|
-
SPEC_ALL: true
|
27
30
|
run: bundle exec rake spec
|
31
|
+
- name: Run integration specs
|
32
|
+
run: bundle exec rake spec:integration
|
28
33
|
rails_specs:
|
29
34
|
name: Rails Specs
|
30
35
|
strategy:
|
@@ -54,4 +59,4 @@ jobs:
|
|
54
59
|
ruby-version: ${{ matrix.ruby }}
|
55
60
|
bundler-cache: true
|
56
61
|
- name: Run Rails specs
|
57
|
-
run: bundle exec rake
|
62
|
+
run: bundle exec rake spec:rails
|
data/Appraisals
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,33 @@
|
|
1
|
+
## [v5.2.3] - 2021-07-29
|
2
|
+
|
3
|
+
- Fire new `:utilization_update` event any time a worker pool's utilization changes
|
4
|
+
- [#673](https://github.com/ruby-shoryuken/shoryuken/pull/673)
|
5
|
+
|
6
|
+
## [v5.2.2] - 2021-06-22
|
7
|
+
|
8
|
+
- When using ActiveJob queue name prefixing, avoid applying prefix to queues configured with a URL or ARN
|
9
|
+
- [#667](https://github.com/ruby-shoryuken/shoryuken/pull/667)
|
10
|
+
|
11
|
+
## [v5.2.1] - 2021-04-06
|
12
|
+
|
13
|
+
- Reduce message batch sizes in `shoryuken sqs requeue` and `shoryuken sqs mv` commands
|
14
|
+
- [#666](https://github.com/ruby-shoryuken/shoryuken/pull/666)
|
15
|
+
|
16
|
+
- Fix bug in `shoryuken sqs requeue` and `shoryuken sqs mv` where those commands would exceed the SQS `SendMessageBatch` maximum payload size
|
17
|
+
- [#663](https://github.com/ruby-shoryuken/shoryuken/issues/663)
|
18
|
+
- [#664](https://github.com/ruby-shoryuken/shoryuken/pull/664)
|
19
|
+
|
20
|
+
- Remove test stub for `Concurrent.global_io_executor`
|
21
|
+
- [#662](https://github.com/ruby-shoryuken/shoryuken/pull/662)
|
22
|
+
|
23
|
+
- Run integration tests on CI
|
24
|
+
- [#660](https://github.com/ruby-shoryuken/shoryuken/pull/660)
|
25
|
+
|
26
|
+
## [v5.2.0] - 2021-02-26
|
27
|
+
|
28
|
+
- Set `executions` correctly for ActiveJob jobs
|
29
|
+
- [#657](https://github.com/phstc/shoryuken/pull/657)
|
30
|
+
|
1
31
|
## [v5.1.1] - 2021-02-10
|
2
32
|
|
3
33
|
- Fix regression in Ruby 3.0 introduced in Shoryuken 5.1.0, where enqueueing jobs with ActiveJob to workers that used keyword arguments would fail
|
data/README.md
CHANGED
@@ -69,7 +69,7 @@ For more information check the [wiki page](https://github.com/phstc/shoryuken/wi
|
|
69
69
|
|
70
70
|
### Testing
|
71
71
|
|
72
|
-
To run all specs against the latest dependency vesions, execute
|
72
|
+
To run all unit specs against the latest dependency vesions, execute
|
73
73
|
|
74
74
|
```sh
|
75
75
|
bundle exec rake spec
|
@@ -78,5 +78,11 @@ bundle exec rake spec
|
|
78
78
|
To run all Rails-related specs against all supported versions of Rails, execute
|
79
79
|
|
80
80
|
```sh
|
81
|
-
bundle exec appraisal rake
|
81
|
+
bundle exec appraisal rake spec:rails
|
82
|
+
```
|
83
|
+
|
84
|
+
To run integration specs, start a mock SQS server on `localhost:5000`. One such option is [cjlarose/moto-sqs-server](https://github.com/cjlarose/moto-sqs-server). Then execute
|
85
|
+
|
86
|
+
```sh
|
87
|
+
bundle exec rake spec:integration
|
82
88
|
```
|
data/Rakefile
CHANGED
@@ -3,10 +3,21 @@ $stdout.sync = true
|
|
3
3
|
|
4
4
|
begin
|
5
5
|
require 'rspec/core/rake_task'
|
6
|
-
RSpec::Core::RakeTask.new(:spec)
|
6
|
+
RSpec::Core::RakeTask.new(:spec) do |t|
|
7
|
+
t.exclude_pattern = 'spec/integration/**/*_spec.rb'
|
8
|
+
end
|
9
|
+
|
10
|
+
namespace :spec do
|
11
|
+
desc 'Run Rails specs only'
|
12
|
+
RSpec::Core::RakeTask.new(:rails) do |t|
|
13
|
+
t.pattern = 'spec/shoryuken/{environment_loader_spec,extensions/active_job_*}.rb'
|
14
|
+
end
|
7
15
|
|
8
|
-
|
9
|
-
|
16
|
+
desc 'Run integration specs only'
|
17
|
+
RSpec::Core::RakeTask.new(:integration) do |t|
|
18
|
+
t.pattern = 'spec/integration/**/*_spec.rb'
|
19
|
+
end
|
20
|
+
end
|
10
21
|
rescue LoadError
|
11
22
|
end
|
12
23
|
|
data/bin/cli/sqs.rb
CHANGED
@@ -4,6 +4,9 @@ require 'date'
|
|
4
4
|
module Shoryuken
|
5
5
|
module CLI
|
6
6
|
class SQS < Base
|
7
|
+
# See https://docs.aws.amazon.com/AWSSimpleQueueService/latest/SQSDeveloperGuide/quotas-messages.html
|
8
|
+
MAX_BATCH_SIZE = 256 * 1024
|
9
|
+
|
7
10
|
namespace :sqs
|
8
11
|
class_option :endpoint, aliases: '-e', type: :string, default: ENV['SHORYUKEN_SQS_ENDPOINT'], desc: 'Endpoint URL'
|
9
12
|
|
@@ -51,14 +54,56 @@ module Shoryuken
|
|
51
54
|
end
|
52
55
|
end
|
53
56
|
|
54
|
-
def batch_send(url, messages,
|
55
|
-
messages.to_a.flatten.map(&method(:normalize_dump_message))
|
56
|
-
|
57
|
-
|
57
|
+
def batch_send(url, messages, max_batch_size = 10)
|
58
|
+
messages = messages.to_a.flatten.map(&method(:normalize_dump_message))
|
59
|
+
batch_send_normalized_messages url, messages, max_batch_size
|
60
|
+
end
|
61
|
+
|
62
|
+
def batch_send_normalized_messages(url, messages, max_batch_size)
|
63
|
+
# Repeatedly take the longest prefix of messages such that
|
64
|
+
# 1. The number of messages is less than or equal to max_batch_size
|
65
|
+
# 2. The total message payload size is less than or equal to the
|
66
|
+
# batch payload limit
|
67
|
+
while messages.size.positive?
|
68
|
+
batch_size = max_batch_size
|
69
|
+
loop do
|
70
|
+
batch = messages.take batch_size
|
71
|
+
|
72
|
+
unless batch.size == 1 || batch_payload_size(batch) <= MAX_BATCH_SIZE
|
73
|
+
batch_size = batch.size - 1
|
74
|
+
next
|
75
|
+
end
|
76
|
+
|
77
|
+
sqs.send_message_batch(queue_url: url, entries: batch).failed.any? do |failure|
|
78
|
+
say "Could not requeue #{failure.id}, code: #{failure.code}", :yellow
|
79
|
+
end
|
80
|
+
messages = messages.drop batch.size
|
81
|
+
break
|
58
82
|
end
|
59
83
|
end
|
60
84
|
end
|
61
85
|
|
86
|
+
def batch_payload_size(messages)
|
87
|
+
messages.sum(&method(:message_size))
|
88
|
+
end
|
89
|
+
|
90
|
+
def message_size(message)
|
91
|
+
attribute_size = (message[:message_attributes] || []).sum do |name, value|
|
92
|
+
name_size = name.to_s.bytesize
|
93
|
+
data_type_size = value[:data_type].bytesize
|
94
|
+
value_size = if value[:string_value]
|
95
|
+
value[:string_value].bytesize
|
96
|
+
elsif value[:binary_value]
|
97
|
+
value[:binary_value].bytesize
|
98
|
+
end
|
99
|
+
name_size + data_type_size + value_size
|
100
|
+
end
|
101
|
+
|
102
|
+
body_size = message[:message_body].bytesize
|
103
|
+
|
104
|
+
attribute_size + body_size
|
105
|
+
end
|
106
|
+
|
62
107
|
def find_all(url, limit)
|
63
108
|
count = 0
|
64
109
|
batch_size = limit > 10 ? 10 : limit
|
@@ -160,7 +205,7 @@ module Shoryuken
|
|
160
205
|
end
|
161
206
|
|
162
207
|
desc 'requeue QUEUE-NAME PATH', 'Requeues messages from a dump file'
|
163
|
-
method_option :batch_size, aliases: '-n', type: :numeric, default: 10, desc: 'number of messages per batch to send'
|
208
|
+
method_option :batch_size, aliases: '-n', type: :numeric, default: 10, desc: 'maximum number of messages per batch to send'
|
164
209
|
def requeue(queue_name, path)
|
165
210
|
fail_task "Path #{path} not found" unless File.exist?(path)
|
166
211
|
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# This file was generated by Appraisal
|
2
|
+
|
3
|
+
source "https://rubygems.org"
|
4
|
+
|
5
|
+
group :test do
|
6
|
+
gem "activejob"
|
7
|
+
gem "aws-sdk-core", "~> 2"
|
8
|
+
gem "codeclimate-test-reporter", require: nil
|
9
|
+
gem "httparty"
|
10
|
+
gem "multi_xml"
|
11
|
+
gem "simplecov"
|
12
|
+
gem "webrick"
|
13
|
+
end
|
14
|
+
|
15
|
+
group :development do
|
16
|
+
gem "appraisal", git: "https://github.com/thoughtbot/appraisal.git"
|
17
|
+
gem "pry-byebug", "3.9.0"
|
18
|
+
gem "rubocop"
|
19
|
+
end
|
20
|
+
|
21
|
+
gemspec path: "../"
|
@@ -80,6 +80,8 @@ module Shoryuken
|
|
80
80
|
end
|
81
81
|
|
82
82
|
def prefix_active_job_queue_name(queue_name, weight)
|
83
|
+
return [queue_name, weight] if queue_name.start_with?('https://', 'arn:')
|
84
|
+
|
83
85
|
queue_name_prefix = ::ActiveJob::Base.queue_name_prefix
|
84
86
|
queue_name_delimiter = ::ActiveJob::Base.queue_name_delimiter
|
85
87
|
|
@@ -82,8 +82,10 @@ module ActiveJob
|
|
82
82
|
|
83
83
|
shoryuken_options body_parser: :json, auto_delete: true
|
84
84
|
|
85
|
-
def perform(
|
86
|
-
|
85
|
+
def perform(sqs_msg, hash)
|
86
|
+
receive_count = sqs_msg.attributes['ApproximateReceiveCount'].to_i
|
87
|
+
past_receives = receive_count - 1
|
88
|
+
Base.execute hash.merge({ 'executions' => past_receives })
|
87
89
|
end
|
88
90
|
end
|
89
91
|
|
data/lib/shoryuken/launcher.rb
CHANGED
@@ -71,6 +71,7 @@ module Shoryuken
|
|
71
71
|
def create_managers
|
72
72
|
Shoryuken.groups.map do |group, options|
|
73
73
|
Shoryuken::Manager.new(
|
74
|
+
group,
|
74
75
|
Shoryuken::Fetcher.new(group),
|
75
76
|
Shoryuken.polling_strategy(group).new(options[:queues], Shoryuken.delay(group)),
|
76
77
|
options[:concurrency],
|
data/lib/shoryuken/manager.rb
CHANGED
@@ -6,7 +6,8 @@ module Shoryuken
|
|
6
6
|
# See https://github.com/phstc/shoryuken/issues/348#issuecomment-292847028
|
7
7
|
MIN_DISPATCH_INTERVAL = 0.1
|
8
8
|
|
9
|
-
def initialize(fetcher, polling_strategy, concurrency, executor)
|
9
|
+
def initialize(group, fetcher, polling_strategy, concurrency, executor)
|
10
|
+
@group = group
|
10
11
|
@fetcher = fetcher
|
11
12
|
@polling_strategy = polling_strategy
|
12
13
|
@max_processors = concurrency
|
@@ -16,6 +17,7 @@ module Shoryuken
|
|
16
17
|
end
|
17
18
|
|
18
19
|
def start
|
20
|
+
fire_utilization_update_event
|
19
21
|
dispatch_loop
|
20
22
|
end
|
21
23
|
|
@@ -59,6 +61,8 @@ module Shoryuken
|
|
59
61
|
|
60
62
|
def processor_done(queue)
|
61
63
|
@busy_processors.decrement
|
64
|
+
fire_utilization_update_event
|
65
|
+
|
62
66
|
client_queue = Shoryuken::Client.queues(queue)
|
63
67
|
return unless client_queue.fifo?
|
64
68
|
return unless @polling_strategy.respond_to?(:message_processed)
|
@@ -72,6 +76,7 @@ module Shoryuken
|
|
72
76
|
logger.debug { "Assigning #{sqs_msg.message_id}" }
|
73
77
|
|
74
78
|
@busy_processors.increment
|
79
|
+
fire_utilization_update_event
|
75
80
|
|
76
81
|
Concurrent::Promise
|
77
82
|
.execute(executor: @executor) { Processor.process(queue_name, sqs_msg) }
|
@@ -114,5 +119,13 @@ module Shoryuken
|
|
114
119
|
|
115
120
|
@running.make_false
|
116
121
|
end
|
122
|
+
|
123
|
+
def fire_utilization_update_event
|
124
|
+
fire_event :utilization_update, false, {
|
125
|
+
group: @group,
|
126
|
+
max_processors: @max_processors,
|
127
|
+
busy_processors: busy
|
128
|
+
}
|
129
|
+
end
|
117
130
|
end
|
118
131
|
end
|
data/lib/shoryuken/options.rb
CHANGED
data/lib/shoryuken/version.rb
CHANGED
@@ -4,10 +4,37 @@ require 'shoryuken/launcher'
|
|
4
4
|
require 'securerandom'
|
5
5
|
|
6
6
|
RSpec.describe Shoryuken::Launcher do
|
7
|
-
|
7
|
+
let(:sqs_client) do
|
8
|
+
Aws::SQS::Client.new(
|
9
|
+
region: 'us-east-1',
|
10
|
+
endpoint: 'http://localhost:5000',
|
11
|
+
access_key_id: 'fake',
|
12
|
+
secret_access_key: 'fake'
|
13
|
+
)
|
14
|
+
end
|
15
|
+
|
16
|
+
let(:executor) do
|
17
|
+
# We can't use Concurrent.global_io_executor in these tests since once you
|
18
|
+
# shut down a thread pool, you can't start it back up. Instead, we create
|
19
|
+
# one new thread pool executor for each spec. We use a new
|
20
|
+
# CachedThreadPool, since that most closely resembles
|
21
|
+
# Concurrent.global_io_executor
|
22
|
+
Concurrent::CachedThreadPool.new auto_terminate: true
|
23
|
+
end
|
24
|
+
|
25
|
+
describe 'Consuming messages' do
|
8
26
|
before do
|
9
27
|
Aws.config[:stub_responses] = false
|
10
|
-
|
28
|
+
|
29
|
+
allow(Shoryuken).to receive(:launcher_executor).and_return(executor)
|
30
|
+
|
31
|
+
Shoryuken.configure_client do |config|
|
32
|
+
config.sqs_client = sqs_client
|
33
|
+
end
|
34
|
+
|
35
|
+
Shoryuken.configure_server do |config|
|
36
|
+
config.sqs_client = sqs_client
|
37
|
+
end
|
11
38
|
|
12
39
|
StandardWorker.received_messages = 0
|
13
40
|
|
@@ -57,11 +57,11 @@ RSpec.describe Shoryuken::EnvironmentLoader do
|
|
57
57
|
ActiveJob::Base.queue_name_delimiter = '_'
|
58
58
|
|
59
59
|
allow(Shoryuken).to receive(:active_job?).and_return(true)
|
60
|
-
end
|
61
60
|
|
62
|
-
specify do
|
63
61
|
Shoryuken.active_job_queue_name_prefixing = true
|
62
|
+
end
|
64
63
|
|
64
|
+
specify do
|
65
65
|
Shoryuken.options[:queues] = ['queue1', ['queue2', 2]]
|
66
66
|
|
67
67
|
Shoryuken.options[:groups] = {
|
@@ -73,6 +73,26 @@ RSpec.describe Shoryuken::EnvironmentLoader do
|
|
73
73
|
expect(Shoryuken.groups['default'][:queues]).to eq(%w[test_queue1 test_queue2 test_queue2])
|
74
74
|
expect(Shoryuken.groups['group1'][:queues]).to eq(%w[test_group1_queue1 test_group1_queue2])
|
75
75
|
end
|
76
|
+
|
77
|
+
it 'does not prefix url-based queues' do
|
78
|
+
Shoryuken.options[:queues] = ['https://example.com/test_queue1']
|
79
|
+
Shoryuken.options[:groups] = {'group1' => {queues: ['https://example.com/test_group1_queue1']}}
|
80
|
+
|
81
|
+
subject.load
|
82
|
+
|
83
|
+
expect(Shoryuken.groups['default'][:queues]).to(eq(['https://example.com/test_queue1']))
|
84
|
+
expect(Shoryuken.groups['group1'][:queues]).to(eq(['https://example.com/test_group1_queue1']))
|
85
|
+
end
|
86
|
+
|
87
|
+
it 'does not prefix arn-based queues' do
|
88
|
+
Shoryuken.options[:queues] = ['arn:aws:sqs:fake-region-1:1234:test_queue1']
|
89
|
+
Shoryuken.options[:groups] = {'group1' => {queues: ['arn:aws:sqs:fake-region-1:1234:test_group1_queue1']}}
|
90
|
+
|
91
|
+
subject.load
|
92
|
+
|
93
|
+
expect(Shoryuken.groups['default'][:queues]).to(eq(['arn:aws:sqs:fake-region-1:1234:test_queue1']))
|
94
|
+
expect(Shoryuken.groups['group1'][:queues]).to(eq(['arn:aws:sqs:fake-region-1:1234:test_group1_queue1']))
|
95
|
+
end
|
76
96
|
end
|
77
97
|
describe "#setup_options" do
|
78
98
|
let (:cli_queues) { { "queue1"=> 10, "queue2" => 20 } }
|
@@ -10,6 +10,10 @@ RSpec.describe ActiveJob::QueueAdapters::ShoryukenConcurrentSendAdapter do
|
|
10
10
|
let(:error_handler) { -> {} }
|
11
11
|
let(:success_handler) { -> {} }
|
12
12
|
|
13
|
+
before do
|
14
|
+
allow(Concurrent).to receive(:global_io_executor).and_return(Concurrent::ImmediateExecutor.new)
|
15
|
+
end
|
16
|
+
|
13
17
|
subject { described_class.new(success_handler, error_handler) }
|
14
18
|
|
15
19
|
context 'when success' do
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
require 'active_job'
|
3
|
+
require 'shoryuken/extensions/active_job_extensions'
|
4
|
+
require 'shoryuken/extensions/active_job_adapter'
|
5
|
+
|
6
|
+
RSpec.describe ActiveJob::QueueAdapters::ShoryukenAdapter::JobWrapper do
|
7
|
+
subject { described_class.new }
|
8
|
+
|
9
|
+
describe '#perform' do
|
10
|
+
it 'sets executions to reflect approximate receive count' do
|
11
|
+
attributes = { 'ApproximateReceiveCount' => '42' }
|
12
|
+
sqs_msg = double Shoryuken::Message, attributes: attributes
|
13
|
+
job_hash = { 'arguments' => [1, 2, 3] }
|
14
|
+
job_hash_with_executions = { 'arguments' => [1, 2, 3], 'executions' => 41 }
|
15
|
+
expect(ActiveJob::Base).to receive(:execute).with(job_hash_with_executions)
|
16
|
+
|
17
|
+
subject.perform sqs_msg, job_hash
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -15,7 +15,7 @@ RSpec.describe Shoryuken::Manager do
|
|
15
15
|
let(:concurrency) { 1 }
|
16
16
|
let(:executor) { Concurrent::ImmediateExecutor.new }
|
17
17
|
|
18
|
-
subject { Shoryuken::Manager.new(fetcher, polling_strategy, concurrency, executor) }
|
18
|
+
subject { Shoryuken::Manager.new('default', fetcher, polling_strategy, concurrency, executor) }
|
19
19
|
|
20
20
|
before do
|
21
21
|
allow(fetcher).to receive(:fetch).and_return([])
|
@@ -71,6 +71,11 @@ RSpec.describe Shoryuken::Manager do
|
|
71
71
|
|
72
72
|
expect(fetcher).to receive(:fetch).with(q, concurrency).and_return(messages)
|
73
73
|
expect(subject).to receive(:fire_event).with(:dispatch, false, queue_name: q.name)
|
74
|
+
expect(subject).to receive(:fire_event).with(:utilization_update,
|
75
|
+
false,
|
76
|
+
group: 'default',
|
77
|
+
busy_processors: 1,
|
78
|
+
max_processors: 1)
|
74
79
|
expect(Shoryuken::Processor).to receive(:process).with(q, message)
|
75
80
|
expect(Shoryuken.logger).to receive(:info).never
|
76
81
|
|
@@ -99,6 +104,11 @@ RSpec.describe Shoryuken::Manager do
|
|
99
104
|
q = Shoryuken::Polling::QueueConfiguration.new(queue, {})
|
100
105
|
|
101
106
|
expect(fetcher).to receive(:fetch).with(q, described_class::BATCH_LIMIT).and_return(messages)
|
107
|
+
expect(subject).to receive(:fire_event).with(:utilization_update,
|
108
|
+
false,
|
109
|
+
group: 'default',
|
110
|
+
busy_processors: 1,
|
111
|
+
max_processors: 1)
|
102
112
|
expect(subject).to receive(:fire_event).with(:dispatch, false, queue_name: q.name)
|
103
113
|
allow(subject).to receive(:batched_queue?).with(q).and_return(true)
|
104
114
|
expect(Shoryuken::Processor).to receive(:process).with(q, messages)
|
data/spec/spec_helper.rb
CHANGED
@@ -32,9 +32,6 @@ class TestWorker
|
|
32
32
|
end
|
33
33
|
|
34
34
|
RSpec.configure do |config|
|
35
|
-
# TODO: Run these tests again on CI
|
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
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-07-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: dotenv
|
@@ -112,7 +112,6 @@ files:
|
|
112
112
|
- Appraisals
|
113
113
|
- CHANGELOG.md
|
114
114
|
- Gemfile
|
115
|
-
- Gemfile.aws-sdk-core-v2
|
116
115
|
- LICENSE
|
117
116
|
- README.md
|
118
117
|
- Rakefile
|
@@ -122,6 +121,7 @@ files:
|
|
122
121
|
- examples/bootstrap_queues.rb
|
123
122
|
- examples/default_worker.rb
|
124
123
|
- gemfiles/.gitignore
|
124
|
+
- gemfiles/aws_sdk_core_2.gemfile
|
125
125
|
- gemfiles/rails_4_2.gemfile
|
126
126
|
- gemfiles/rails_5_2.gemfile
|
127
127
|
- gemfiles/rails_6_0.gemfile
|
@@ -172,6 +172,7 @@ files:
|
|
172
172
|
- spec/shoryuken/extensions/active_job_adapter_spec.rb
|
173
173
|
- spec/shoryuken/extensions/active_job_base_spec.rb
|
174
174
|
- spec/shoryuken/extensions/active_job_concurrent_send_adapter_spec.rb
|
175
|
+
- spec/shoryuken/extensions/active_job_wrapper_spec.rb
|
175
176
|
- spec/shoryuken/fetcher_spec.rb
|
176
177
|
- spec/shoryuken/manager_spec.rb
|
177
178
|
- spec/shoryuken/middleware/chain_spec.rb
|
@@ -228,6 +229,7 @@ test_files:
|
|
228
229
|
- spec/shoryuken/extensions/active_job_adapter_spec.rb
|
229
230
|
- spec/shoryuken/extensions/active_job_base_spec.rb
|
230
231
|
- spec/shoryuken/extensions/active_job_concurrent_send_adapter_spec.rb
|
232
|
+
- spec/shoryuken/extensions/active_job_wrapper_spec.rb
|
231
233
|
- spec/shoryuken/fetcher_spec.rb
|
232
234
|
- spec/shoryuken/manager_spec.rb
|
233
235
|
- spec/shoryuken/middleware/chain_spec.rb
|
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
|