shoryuken 5.2.2 → 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 +2 -2
- data/Appraisals +8 -0
- data/CHANGELOG.md +5 -0
- data/gemfiles/aws_sdk_core_2.gemfile +21 -0
- 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/shoryuken/manager_spec.rb +11 -1
- metadata +3 -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,8 +9,8 @@ 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
15
|
services:
|
16
16
|
moto_sqs:
|
data/Appraisals
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,8 @@
|
|
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
|
+
|
1
6
|
## [v5.2.2] - 2021-06-22
|
2
7
|
|
3
8
|
- When using ActiveJob queue name prefixing, avoid applying prefix to queues configured with a URL or ARN
|
@@ -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: "../"
|
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
@@ -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)
|
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.2.
|
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
|
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
|