shoryuken 3.0.4 → 3.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/bin/shoryuken +9 -1
- data/lib/shoryuken/manager.rb +11 -2
- data/lib/shoryuken/processor.rb +3 -0
- data/lib/shoryuken/version.rb +1 -1
- data/spec/shoryuken/processor_spec.rb +2 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a7a48b27440a94923275b030e8785feb20e3b628
|
4
|
+
data.tar.gz: 629c1e8369fef39bf795860d3cdd565f2ed6c886
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 77e1c8fb04eea615ae5ba684978c5278631a3dab89119d9519ee3e0514da3ca3cdeb12feb672beb2024f5f708d986953b1b6a0191ea4c3e75e3e507809c710e3
|
7
|
+
data.tar.gz: dbff1f35986729de23d4934dccab52546642297334f1117c925c89fdbf8735575ae2dd0bc990e547018a60921a19f59cd04968093d73072609156ac8ff4541f5
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
## [v3.0.5] - 2017-04-09
|
2
|
+
- Pause endless dispatcher to avoid CPU overload
|
3
|
+
- [#354](https://github.com/phstc/shoryuken/pull/354)
|
4
|
+
|
5
|
+
- Auto log processor errors
|
6
|
+
- [#355](https://github.com/phstc/shoryuken/pull/355)
|
7
|
+
|
8
|
+
- Add a delay as a CLI param
|
9
|
+
- [#350](https://github.com/phstc/shoryuken/pull/350)
|
10
|
+
|
11
|
+
- Add `sqs purge` command. See https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_PurgeQueue.html
|
12
|
+
- [#344](https://github.com/phstc/shoryuken/pull/344)
|
1
13
|
## [v3.0.4] - 2017-03-24
|
2
14
|
- Add `sqs purge` command. See https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_PurgeQueue.html
|
3
15
|
- [#344](https://github.com/phstc/shoryuken/pull/344)
|
data/bin/shoryuken
CHANGED
@@ -21,14 +21,22 @@ module Shoryuken
|
|
21
21
|
method_option :daemon, aliases: '-d', type: :boolean, desc: 'Daemonize process'
|
22
22
|
method_option :queues, aliases: '-q', type: :array, desc: 'Queues to process with optional weights'
|
23
23
|
method_option :require, aliases: '-r', type: :string, desc: 'Dir or path of the workers'
|
24
|
-
method_option :
|
24
|
+
method_option :config, aliases: '-C', type: :string, desc: 'Path to config file'
|
25
|
+
method_option :config_file, type: :string, desc: 'Path to config file (backwards compatibility)'
|
25
26
|
method_option :rails, aliases: '-R', type: :boolean, desc: 'Load Rails'
|
26
27
|
method_option :logfile, aliases: '-L', type: :string, desc: 'Path to logfile'
|
27
28
|
method_option :pidfile, aliases: '-P', type: :string, desc: 'Path to pidfile'
|
28
29
|
method_option :verbose, aliases: '-v', type: :boolean, desc: 'Print more verbose output'
|
30
|
+
method_option :delay, aliases: '-D', type: :boolean, desc: 'Number of seconds to pause fetching from an empty queue'
|
29
31
|
def start
|
30
32
|
opts = options.to_h.symbolize_keys
|
31
33
|
|
34
|
+
if opts[:config_file]
|
35
|
+
say "[DEPRECATED] Please use --config instead of --config-file", :yellow
|
36
|
+
end
|
37
|
+
|
38
|
+
opts[:config_file] = opts.delete(:config) if opts[:config]
|
39
|
+
|
32
40
|
# Keep compatibility with old CLI queue format
|
33
41
|
opts[:queues] = options[:queues].map { |q| q.split(',') } if options[:queues]
|
34
42
|
|
data/lib/shoryuken/manager.rb
CHANGED
@@ -3,6 +3,8 @@ module Shoryuken
|
|
3
3
|
include Util
|
4
4
|
|
5
5
|
BATCH_LIMIT = 10
|
6
|
+
# See https://github.com/phstc/shoryuken/issues/348#issuecomment-292847028
|
7
|
+
MIN_DISPATCH_INTERVAL = 0.1
|
6
8
|
|
7
9
|
def initialize(fetcher, polling_strategy)
|
8
10
|
@count = Shoryuken.options.fetch(:concurrency, 25)
|
@@ -47,6 +49,11 @@ module Shoryuken
|
|
47
49
|
end
|
48
50
|
end
|
49
51
|
|
52
|
+
def processor_failed(ex)
|
53
|
+
logger.error ex
|
54
|
+
logger.error ex.backtrace.join("\n") unless ex.backtrace.nil?
|
55
|
+
end
|
56
|
+
|
50
57
|
def processor_done(queue)
|
51
58
|
logger.debug { "Process done for '#{queue}'" }
|
52
59
|
end
|
@@ -61,8 +68,10 @@ module Shoryuken
|
|
61
68
|
return if @done.true?
|
62
69
|
|
63
70
|
begin
|
64
|
-
|
65
|
-
|
71
|
+
if ready.zero? || (queue = @polling_strategy.next_queue).nil?
|
72
|
+
sleep MIN_DISPATCH_INTERVAL
|
73
|
+
return
|
74
|
+
end
|
66
75
|
|
67
76
|
logger.debug { "Ready: #{ready}, Busy: #{busy}, Active Queues: #{@polling_strategy.active_queues}" }
|
68
77
|
|
data/lib/shoryuken/processor.rb
CHANGED
data/lib/shoryuken/version.rb
CHANGED
@@ -99,6 +99,7 @@ RSpec.describe Shoryuken::Processor do
|
|
99
99
|
end
|
100
100
|
|
101
101
|
it 'logs the error' do
|
102
|
+
expect(manager).to receive(:processor_failed)
|
102
103
|
expect(subject.logger).to receive(:error) do |&block|
|
103
104
|
expect(block.call).
|
104
105
|
to include("unexpected token at 'invalid json'\nbody_parser: json\nsqs_msg.body: invalid json")
|
@@ -108,6 +109,7 @@ RSpec.describe Shoryuken::Processor do
|
|
108
109
|
end
|
109
110
|
|
110
111
|
it 're raises the error' do
|
112
|
+
expect(manager).to receive(:processor_failed)
|
111
113
|
expect { subject.process(queue, sqs_msg) }.
|
112
114
|
to raise_error(JSON::ParserError, /unexpected token at 'invalid json'/)
|
113
115
|
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: 3.0.
|
4
|
+
version: 3.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pablo Cantero
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-04-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|