shoryuken 3.0.6 → 3.0.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ed324ac96e13143c24ee4cd81623c80c3558f1bf
4
- data.tar.gz: 1f88dd595425bd1c9185a1ce33ab9c8ad4945bcd
3
+ metadata.gz: 3d0347fa63667fbc483984759877ee74a65919cd
4
+ data.tar.gz: a06ea715ee035e398cdab792c2647b3e6575f216
5
5
  SHA512:
6
- metadata.gz: 809cbd0b7dde05a27458d4b44fa3452efb0542a9fda8e2ed06b6bcd1e2ea443b67eaca4e38aa958b6252b40db6ffbda3974afee38f3e018d1f37f6ed4d650aa8
7
- data.tar.gz: 04b8353ecbb0d0a5458446a821e86e808c8106aa6e5805d769351a191a34cf5a018a7502edc5cdf99afd1937194b79338d31b08ed6e4b0102c757511b4338dfc
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: 25
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
- And supposing all the queues are full of messages, the configuration above will make Shoryuken to process `high_priority` 3 times more than `normal_priority` and 6 times more than `low_priority`,
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: 25 # The delay in seconds to pause a queue when it's empty. Default 0
107
+ delay: 0 # The delay in seconds to pause empty queues. Default 0
115
108
  queues:
116
- - [high_priority, 6]
117
- - [normal_priority, 2]
118
- - [low_priority, 1]
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
@@ -35,6 +35,7 @@ module Shoryuken
35
35
  timeout: 8,
36
36
  lifecycle_events: {
37
37
  startup: [],
38
+ dispatch: [],
38
39
  quiet: [],
39
40
  shutdown: []
40
41
  },
@@ -73,6 +73,8 @@ module Shoryuken
73
73
  return
74
74
  end
75
75
 
76
+ fire_event(:dispatch)
77
+
76
78
  logger.debug { "Ready: #{ready}, Busy: #{busy}, Active Queues: #{@polling_strategy.active_queues}" }
77
79
 
78
80
  batched_queue?(queue) ? dispatch_batch(queue) : dispatch_single_messages(queue)
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Shoryuken
2
- VERSION = '3.0.6'.freeze
2
+ VERSION = '3.0.7'.freeze
3
3
  end
@@ -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.6
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-04-11 00:00:00.000000000 Z
11
+ date: 2017-05-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler