shoryuken 5.2.3 → 6.2.1

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.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/.devcontainer/Dockerfile +17 -0
  3. data/.devcontainer/base.Dockerfile +43 -0
  4. data/.devcontainer/devcontainer.json +35 -0
  5. data/.github/dependabot.yml +6 -0
  6. data/.github/workflows/specs.yml +5 -2
  7. data/.github/workflows/stale.yml +20 -0
  8. data/.gitignore +1 -1
  9. data/.rubocop.yml +1 -1
  10. data/Appraisals +6 -0
  11. data/CHANGELOG.md +152 -0
  12. data/Gemfile +6 -3
  13. data/README.md +19 -1
  14. data/bin/cli/sqs.rb +1 -1
  15. data/gemfiles/aws_sdk_core_2.gemfile +1 -1
  16. data/gemfiles/rails_7_0.gemfile +22 -0
  17. data/lib/shoryuken/default_exception_handler.rb +10 -0
  18. data/lib/shoryuken/environment_loader.rb +22 -3
  19. data/lib/shoryuken/extensions/active_job_adapter.rb +5 -2
  20. data/lib/shoryuken/extensions/active_job_extensions.rb +1 -1
  21. data/lib/shoryuken/launcher.rb +25 -3
  22. data/lib/shoryuken/logging.rb +2 -2
  23. data/lib/shoryuken/manager.rb +27 -10
  24. data/lib/shoryuken/message.rb +11 -28
  25. data/lib/shoryuken/middleware/server/active_record.rb +5 -1
  26. data/lib/shoryuken/options.rb +14 -6
  27. data/lib/shoryuken/polling/strict_priority.rb +4 -2
  28. data/lib/shoryuken/polling/weighted_round_robin.rb +3 -5
  29. data/lib/shoryuken/processor.rb +14 -6
  30. data/lib/shoryuken/queue.rb +5 -3
  31. data/lib/shoryuken/runner.rb +4 -3
  32. data/lib/shoryuken/version.rb +1 -1
  33. data/lib/shoryuken.rb +11 -0
  34. data/shoryuken.gemspec +1 -1
  35. data/spec/shared_examples_for_active_job.rb +4 -2
  36. data/spec/shoryuken/default_exception_handler_spec.rb +71 -0
  37. data/spec/shoryuken/environment_loader_spec.rb +42 -9
  38. data/spec/shoryuken/extensions/active_job_base_spec.rb +1 -1
  39. data/spec/shoryuken/fetcher_spec.rb +12 -12
  40. data/spec/shoryuken/launcher_spec.rb +105 -0
  41. data/spec/shoryuken/manager_spec.rb +32 -6
  42. data/spec/shoryuken/polling/weighted_round_robin_spec.rb +31 -6
  43. data/spec/shoryuken/processor_spec.rb +38 -0
  44. data/spec/shoryuken/queue_spec.rb +10 -5
  45. data/spec/shoryuken/util_spec.rb +24 -4
  46. data/spec/shoryuken/worker/default_executor_spec.rb +48 -48
  47. data/spec/shoryuken_spec.rb +9 -0
  48. data/spec/spec_helper.rb +2 -0
  49. metadata +18 -7
@@ -10,16 +10,16 @@ RSpec.describe Shoryuken::Worker::DefaultExecutor do
10
10
 
11
11
  describe '.perform_in' do
12
12
  it 'delays a message' do
13
- expect(sqs_queue).to receive(:send_message).with(
14
- message_attributes: {
15
- 'shoryuken_class' => {
16
- string_value: TestWorker.to_s,
17
- data_type: 'String'
18
- }
19
- },
20
- message_body: 'message',
21
- delay_seconds: 60
22
- )
13
+ expect(sqs_queue).to receive(:send_message).with({
14
+ message_attributes: {
15
+ 'shoryuken_class' => {
16
+ string_value: TestWorker.to_s,
17
+ data_type: 'String'
18
+ }
19
+ },
20
+ message_body: 'message',
21
+ delay_seconds: 60
22
+ })
23
23
 
24
24
  TestWorker.perform_in(60, 'message')
25
25
  end
@@ -33,16 +33,16 @@ RSpec.describe Shoryuken::Worker::DefaultExecutor do
33
33
 
34
34
  describe '.perform_at' do
35
35
  it 'delays a message' do
36
- expect(sqs_queue).to receive(:send_message).with(
37
- message_attributes: {
38
- 'shoryuken_class' => {
39
- string_value: TestWorker.to_s,
40
- data_type: 'String'
41
- }
42
- },
43
- message_body: 'message',
44
- delay_seconds: 60
45
- )
36
+ expect(sqs_queue).to receive(:send_message).with({
37
+ message_attributes: {
38
+ 'shoryuken_class' => {
39
+ string_value: TestWorker.to_s,
40
+ data_type: 'String'
41
+ }
42
+ },
43
+ message_body: 'message',
44
+ delay_seconds: 60
45
+ })
46
46
 
47
47
  TestWorker.perform_in(Time.now + 60, 'message')
48
48
  end
@@ -56,30 +56,30 @@ RSpec.describe Shoryuken::Worker::DefaultExecutor do
56
56
 
57
57
  describe '.perform_async' do
58
58
  it 'enqueues a message' do
59
- expect(sqs_queue).to receive(:send_message).with(
60
- message_attributes: {
61
- 'shoryuken_class' => {
62
- string_value: TestWorker.to_s,
63
- data_type: 'String'
64
- }
65
- },
66
- message_body: 'message'
67
- )
59
+ expect(sqs_queue).to receive(:send_message).with({
60
+ message_attributes: {
61
+ 'shoryuken_class' => {
62
+ string_value: TestWorker.to_s,
63
+ data_type: 'String'
64
+ }
65
+ },
66
+ message_body: 'message'
67
+ })
68
68
 
69
69
  TestWorker.perform_async('message')
70
70
  end
71
71
 
72
72
  it 'enqueues a message with options' do
73
- expect(sqs_queue).to receive(:send_message).with(
74
- delay_seconds: 60,
75
- message_attributes: {
76
- 'shoryuken_class' => {
77
- string_value: TestWorker.to_s,
78
- data_type: 'String'
79
- }
80
- },
81
- message_body: 'delayed message'
82
- )
73
+ expect(sqs_queue).to receive(:send_message).with({
74
+ delay_seconds: 60,
75
+ message_attributes: {
76
+ 'shoryuken_class' => {
77
+ string_value: TestWorker.to_s,
78
+ data_type: 'String'
79
+ }
80
+ },
81
+ message_body: 'delayed message'
82
+ })
83
83
 
84
84
  TestWorker.perform_async('delayed message', delay_seconds: 60)
85
85
  end
@@ -89,15 +89,15 @@ RSpec.describe Shoryuken::Worker::DefaultExecutor do
89
89
 
90
90
  expect(Shoryuken::Client).to receive(:queues).with(new_queue).and_return(sqs_queue)
91
91
 
92
- expect(sqs_queue).to receive(:send_message).with(
93
- message_attributes: {
94
- 'shoryuken_class' => {
95
- string_value: TestWorker.to_s,
96
- data_type: 'String'
97
- }
98
- },
99
- message_body: 'delayed message'
100
- )
92
+ expect(sqs_queue).to receive(:send_message).with({
93
+ message_attributes: {
94
+ 'shoryuken_class' => {
95
+ string_value: TestWorker.to_s,
96
+ data_type: 'String'
97
+ }
98
+ },
99
+ message_body: 'delayed message'
100
+ })
101
101
 
102
102
  TestWorker.perform_async('delayed message', queue: new_queue)
103
103
  end
@@ -1,4 +1,13 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  RSpec.describe Shoryuken do
4
+ describe '.healthy?' do
5
+ before do
6
+ allow(Shoryuken::Runner).to receive(:instance).and_return(double(:instance, healthy?: :some_result))
7
+ end
8
+
9
+ it 'delegates to the runner instance' do
10
+ expect(described_class.healthy?).to eq(:some_result)
11
+ end
12
+ end
4
13
  end
data/spec/spec_helper.rb CHANGED
@@ -46,6 +46,8 @@ RSpec.configure do |config|
46
46
  Shoryuken.options[:logfile] = nil
47
47
  Shoryuken.options[:queues] = nil
48
48
 
49
+ Shoryuken.options[:exception_handlers] = []
50
+
49
51
  TestWorker.get_shoryuken_options.clear
50
52
  TestWorker.get_shoryuken_options['queue'] = 'default'
51
53
 
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.3
4
+ version: 6.2.1
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: 2021-07-30 00:00:00.000000000 Z
11
+ date: 2024-02-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: dotenv
@@ -103,8 +103,13 @@ extensions: []
103
103
  extra_rdoc_files: []
104
104
  files:
105
105
  - ".codeclimate.yml"
106
+ - ".devcontainer/Dockerfile"
107
+ - ".devcontainer/base.Dockerfile"
108
+ - ".devcontainer/devcontainer.json"
106
109
  - ".github/FUNDING.yml"
110
+ - ".github/dependabot.yml"
107
111
  - ".github/workflows/specs.yml"
112
+ - ".github/workflows/stale.yml"
108
113
  - ".gitignore"
109
114
  - ".reek.yml"
110
115
  - ".rspec"
@@ -126,10 +131,12 @@ files:
126
131
  - gemfiles/rails_5_2.gemfile
127
132
  - gemfiles/rails_6_0.gemfile
128
133
  - gemfiles/rails_6_1.gemfile
134
+ - gemfiles/rails_7_0.gemfile
129
135
  - lib/shoryuken.rb
130
136
  - lib/shoryuken/body_parser.rb
131
137
  - lib/shoryuken/client.rb
132
138
  - lib/shoryuken/core_ext.rb
139
+ - lib/shoryuken/default_exception_handler.rb
133
140
  - lib/shoryuken/default_worker_registry.rb
134
141
  - lib/shoryuken/environment_loader.rb
135
142
  - lib/shoryuken/extensions/active_job_adapter.rb
@@ -167,6 +174,7 @@ files:
167
174
  - spec/shoryuken/body_parser_spec.rb
168
175
  - spec/shoryuken/client_spec.rb
169
176
  - spec/shoryuken/core_ext_spec.rb
177
+ - spec/shoryuken/default_exception_handler_spec.rb
170
178
  - spec/shoryuken/default_worker_registry_spec.rb
171
179
  - spec/shoryuken/environment_loader_spec.rb
172
180
  - spec/shoryuken/extensions/active_job_adapter_spec.rb
@@ -174,6 +182,7 @@ files:
174
182
  - spec/shoryuken/extensions/active_job_concurrent_send_adapter_spec.rb
175
183
  - spec/shoryuken/extensions/active_job_wrapper_spec.rb
176
184
  - spec/shoryuken/fetcher_spec.rb
185
+ - spec/shoryuken/launcher_spec.rb
177
186
  - spec/shoryuken/manager_spec.rb
178
187
  - spec/shoryuken/middleware/chain_spec.rb
179
188
  - spec/shoryuken/middleware/server/auto_delete_spec.rb
@@ -194,11 +203,11 @@ files:
194
203
  - spec/spec_helper.rb
195
204
  - test_workers/endless_interruptive_worker.rb
196
205
  - test_workers/endless_uninterruptive_worker.rb
197
- homepage: https://github.com/phstc/shoryuken
206
+ homepage: https://github.com/ruby-shoryuken/shoryuken
198
207
  licenses:
199
208
  - LGPL-3.0
200
209
  metadata: {}
201
- post_install_message:
210
+ post_install_message:
202
211
  rdoc_options: []
203
212
  require_paths:
204
213
  - lib
@@ -213,8 +222,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
213
222
  - !ruby/object:Gem::Version
214
223
  version: '0'
215
224
  requirements: []
216
- rubygems_version: 3.0.1
217
- signing_key:
225
+ rubygems_version: 3.3.26
226
+ signing_key:
218
227
  specification_version: 4
219
228
  summary: Shoryuken is a super efficient AWS SQS thread based message processor
220
229
  test_files:
@@ -224,6 +233,7 @@ test_files:
224
233
  - spec/shoryuken/body_parser_spec.rb
225
234
  - spec/shoryuken/client_spec.rb
226
235
  - spec/shoryuken/core_ext_spec.rb
236
+ - spec/shoryuken/default_exception_handler_spec.rb
227
237
  - spec/shoryuken/default_worker_registry_spec.rb
228
238
  - spec/shoryuken/environment_loader_spec.rb
229
239
  - spec/shoryuken/extensions/active_job_adapter_spec.rb
@@ -231,6 +241,7 @@ test_files:
231
241
  - spec/shoryuken/extensions/active_job_concurrent_send_adapter_spec.rb
232
242
  - spec/shoryuken/extensions/active_job_wrapper_spec.rb
233
243
  - spec/shoryuken/fetcher_spec.rb
244
+ - spec/shoryuken/launcher_spec.rb
234
245
  - spec/shoryuken/manager_spec.rb
235
246
  - spec/shoryuken/middleware/chain_spec.rb
236
247
  - spec/shoryuken/middleware/server/auto_delete_spec.rb