shoryuken 3.0.6 → 3.0.7
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/CHANGELOG.md +10 -0
- data/README.md +8 -15
- data/bin/cli/base.rb +0 -2
- data/lib/shoryuken.rb +1 -0
- data/lib/shoryuken/manager.rb +2 -0
- data/lib/shoryuken/middleware/server/exponential_backoff_retry.rb +5 -1
- data/lib/shoryuken/version.rb +1 -1
- data/spec/shoryuken/manager_spec.rb +7 -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: 3d0347fa63667fbc483984759877ee74a65919cd
|
4
|
+
data.tar.gz: a06ea715ee035e398cdab792c2647b3e6575f216
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a560a9dbc3f31706263ac0f3d15a90b976e7dcc2b040eab0317e0ceb782ea239cea95c8e96d0c6bf0ee7cc4a3d4be30fb2249ddc177c35500a60b463e52beee
|
7
|
+
data.tar.gz: 94776b105d1288009d3b5d93022a6c0fd95a5981daa13925c0453802d90e6215e0d37eb5b044af8ce267559b9becdc49921e9842e6b34b672cb892762f6e4615
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,13 @@
|
|
1
|
+
## [v3.0.7] - 2017-05-18
|
2
|
+
- Trigger events for dispatch
|
3
|
+
- [#362](https://github.com/phstc/shoryuken/pull/362)
|
4
|
+
|
5
|
+
- Log (warn) exponential backoff tries
|
6
|
+
- [#365](https://github.com/phstc/shoryuken/pull/365)
|
7
|
+
|
8
|
+
- Fix displaying of long queue names in `shoryuken sqs ls`
|
9
|
+
- [#366](https://github.com/phstc/shoryuken/pull/366)
|
10
|
+
|
1
11
|
## [v3.0.6] - 2017-04-11
|
2
12
|
- Fix delay option type
|
3
13
|
- [#356](https://github.com/phstc/shoryuken/pull/356)
|
data/README.md
CHANGED
@@ -13,26 +13,19 @@ Shoryuken _sho-ryu-ken_ is a super-efficient [AWS SQS](https://aws.amazon.com/sq
|
|
13
13
|
|
14
14
|
Yeah, Shoryuken load balances the messages consumption!
|
15
15
|
|
16
|
-
Given this configuration:
|
17
|
-
|
18
16
|
```yaml
|
19
17
|
concurrency: 25
|
20
|
-
delay:
|
18
|
+
delay: 0
|
21
19
|
queues:
|
22
20
|
- [high_priority, 6]
|
23
21
|
- [normal_priority, 2]
|
24
22
|
- [low_priority, 1]
|
25
23
|
```
|
26
24
|
|
27
|
-
|
28
|
-
splitting the work load among all available processors `concurrency: 25` .
|
29
|
-
|
30
|
-
If `high_priority` gets empty, Shoryuken will keep using the 25 processors, but only to process `normal_priority` and `low_priority`.
|
31
|
-
|
32
|
-
If `high_priority` receives a new message, Shoryuken will smoothly increase back its weight one by one until it reaches the weight of 6 again.
|
33
|
-
|
34
|
-
[If a queue gets empty, Shoryuken will pause checking it for `delay: 25`](https://github.com/phstc/shoryuken/wiki/Shoryuken-options#delay).
|
25
|
+
Or you can set them all to 1 for having the same priorities.
|
35
26
|
|
27
|
+
- `concurrency` (default 25) is the number of threads you want to make available for processing.
|
28
|
+
- `delay` (default to 0) is the number of seconds to pause fetching from an empty queue. SQS charges per request, pause checking empty queues for a while can be a cost efficient strategy.
|
36
29
|
|
37
30
|
### Fetch in batches
|
38
31
|
|
@@ -111,11 +104,11 @@ Sample configuration file `shoryuken.yml`.
|
|
111
104
|
|
112
105
|
```yaml
|
113
106
|
concurrency: 25 # The number of allocated threads to process messages. Default 25
|
114
|
-
delay:
|
107
|
+
delay: 0 # The delay in seconds to pause empty queues. Default 0
|
115
108
|
queues:
|
116
|
-
- [
|
117
|
-
- [
|
118
|
-
- [
|
109
|
+
- [queue1, 1]
|
110
|
+
- [queue2, 1]
|
111
|
+
- [queue3, 1]
|
119
112
|
```
|
120
113
|
|
121
114
|
#### AWS Configuration
|
data/bin/cli/base.rb
CHANGED
@@ -25,10 +25,8 @@ module Shoryuken
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def print_format_column(column, size)
|
28
|
-
size = 40 if size > 40
|
29
28
|
size_with_padding = size + 4
|
30
29
|
column = column.to_s.ljust(size_with_padding)
|
31
|
-
column = "#{column[0...size - 2]}.." if column.size > size_with_padding
|
32
30
|
column
|
33
31
|
end
|
34
32
|
|
data/lib/shoryuken.rb
CHANGED
data/lib/shoryuken/manager.rb
CHANGED
@@ -12,7 +12,7 @@ module Shoryuken
|
|
12
12
|
|
13
13
|
started_at = Time.now
|
14
14
|
yield
|
15
|
-
rescue
|
15
|
+
rescue => ex
|
16
16
|
retry_intervals = worker.class.get_shoryuken_options['retry_intervals']
|
17
17
|
|
18
18
|
if retry_intervals.nil? || !handle_failure(sqs_msg, started_at, retry_intervals)
|
@@ -20,6 +20,10 @@ module Shoryuken
|
|
20
20
|
# This allows custom middleware (like exception notifiers) to be aware of the unhandled failure.
|
21
21
|
raise
|
22
22
|
end
|
23
|
+
|
24
|
+
logger.warn { "Message #{sqs_msg.message_id} will attempt retry due to error: #{ex.message}" }
|
25
|
+
# since we didn't raise, lets log the backtrace for debugging purposes.
|
26
|
+
logger.debug ex.backtrace.join("\n") unless ex.backtrace.nil?
|
23
27
|
end
|
24
28
|
|
25
29
|
private
|
data/lib/shoryuken/version.rb
CHANGED
@@ -55,6 +55,13 @@ RSpec.describe Shoryuken::Manager do
|
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
58
|
+
describe '#dispatch_now' do
|
59
|
+
it 'fires a dispatch event' do
|
60
|
+
expect(subject).to receive(:fire_event).with(:dispatch).once
|
61
|
+
subject.send(:dispatch_now)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
58
65
|
describe '#dispatch_batch' do
|
59
66
|
it 'assings batch as a single message' do
|
60
67
|
q = polling_strategy.next_queue
|
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.7
|
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-05-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|