shoryuken 2.0.2 → 2.0.3

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: f62098d7fa2041d2ae1cfd8a4cfedd0e09766bbb
4
- data.tar.gz: 38445deab5aeb3a08310d105264338d64e5d835d
3
+ metadata.gz: fff521cc6ef6173b686df9b83b5145901d3b20cb
4
+ data.tar.gz: a7841963b11b2e4025ab368698e7571df0e506e9
5
5
  SHA512:
6
- metadata.gz: 7ac1f46247119f055a0ed55494d7e39f687520197790458effdb8b23323cf9cb8d54ba64ce5107e8e53285522c7083dc90298afc2b202589945b80c51d5c1835
7
- data.tar.gz: 6c2997f79ad3822134fa0a2f5be6563e3b382ac17134a7afcdaf812c78719f56f657c430ee7b3b4880f0ca9022f3e17514f9e7e1a835a71283e65fa169e6d36d
6
+ metadata.gz: 3c45ecb9a4a2d63408978af8eda9d7a2fcf85122a1a603b16550143dff23f16f6e145b0f2985f85b41f1be8f107b1c8a4bf232d75e931d9e0b5635fd82bba7ab
7
+ data.tar.gz: 80410090f98a1a9d3112401c0fbf02e44b5b1f7fdb6e753df2f6ae2b4887927dcadc9937b2395fd5421c790892984c2e0fea4b3475077bf2411a0de0ecb854a9
@@ -1,4 +1,12 @@
1
- ## [v2.0.2] - 2015-10-22
1
+ ## [v2.0.3] - 2015-12-30
2
+
3
+ - Allow multiple queues per worker
4
+ - [#164](https://github.com/phstc/shoryuken/pull/164)
5
+
6
+ - Fix typo
7
+ - [#166](https://github.com/phstc/shoryuken/pull/166)
8
+
9
+ ## [v2.0.2] - 2015-10-27
2
10
 
3
11
  - Fix warnings that are triggered in some cases with the raise_error matcher
4
12
  - [#144](https://github.com/phstc/shoryuken/pull/144)
data/README.md CHANGED
@@ -169,7 +169,7 @@ shoryuken [options]
169
169
 
170
170
  ## More Information
171
171
 
172
- Please check the [Shoryuken Wiki](https://github.com/phstc/shoryuken/wiki).
172
+ For more information on advanced topics such as signals (shutdown), ActiveJob integration, and so on please check the [Shoryuken Wiki](https://github.com/phstc/shoryuken/wiki).
173
173
 
174
174
  ## Credits
175
175
 
@@ -11,7 +11,7 @@ module Shoryuken
11
11
  self.queue_name = queue.name
12
12
  else
13
13
  # TODO: Remove next major release
14
- Shoryuken.loggger.warn do
14
+ Shoryuken.logger.warn do
15
15
  '[DEPRECATION] Passing a queue url into Shoryuken::Message is deprecated, please pass the queue itself'
16
16
  end
17
17
  self.queue_url = queue
@@ -1,3 +1,3 @@
1
1
  module Shoryuken
2
- VERSION = '2.0.2'
2
+ VERSION = '2.0.3'
3
3
  end
@@ -41,13 +41,7 @@ module Shoryuken
41
41
 
42
42
  def shoryuken_options(opts = {})
43
43
  @shoryuken_options = get_shoryuken_options.merge(stringify_keys(opts || {}))
44
- queue = @shoryuken_options['queue']
45
- if queue.respond_to? :call
46
- queue = queue.call
47
- @shoryuken_options['queue'] = queue
48
- end
49
-
50
- Shoryuken.register_worker(queue, self)
44
+ normalize_worker_queue!
51
45
  end
52
46
 
53
47
  def auto_visibility_timeout?
@@ -64,6 +58,22 @@ module Shoryuken
64
58
  end
65
59
  hash
66
60
  end
61
+
62
+ private
63
+
64
+ def normalize_worker_queue!
65
+ queue = @shoryuken_options['queue']
66
+ if queue.respond_to? :call
67
+ queue = queue.call
68
+ @shoryuken_options['queue'] = queue
69
+ end
70
+
71
+ [@shoryuken_options['queue']].flatten.compact.each(&method(:register_worker))
72
+ end
73
+
74
+ def register_worker(queue)
75
+ Shoryuken.register_worker(queue, self)
76
+ end
67
77
  end
68
78
  end
69
79
  end
@@ -25,5 +25,5 @@ Gem::Specification.new do |spec|
25
25
  spec.add_development_dependency 'dotenv'
26
26
 
27
27
  spec.add_dependency 'aws-sdk-core', '~> 2'
28
- spec.add_dependency 'celluloid', '~> 0.16.0'
28
+ spec.add_dependency 'celluloid', '~> 0.16'
29
29
  end
@@ -2,7 +2,7 @@ require 'spec_helper'
2
2
  require 'shoryuken/manager'
3
3
  require 'shoryuken/launcher'
4
4
 
5
- describe Shoryuken::Launcher do
5
+ RSpec.describe Shoryuken::Launcher do
6
6
  describe 'Consuming messages', slow: :true do
7
7
  before do
8
8
  Shoryuken.options[:aws][:receive_message] = { wait_time_seconds: 5 }
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe 'Shoryuken::Worker' do
3
+ RSpec.describe 'Shoryuken::Worker' do
4
4
  let(:sqs_queue) { double 'SQS Queue' }
5
5
  let(:queue) { 'default' }
6
6
 
@@ -103,7 +103,7 @@ describe 'Shoryuken::Worker' do
103
103
  expect(Shoryuken.worker_registry.workers('default')).to eq([TestWorker])
104
104
  end
105
105
 
106
- it 'accepts a block as queue name' do
106
+ it 'accepts a block as a queue' do
107
107
  $queue_prefix = 'production'
108
108
 
109
109
  class NewTestWorker
@@ -116,6 +116,18 @@ describe 'Shoryuken::Worker' do
116
116
  expect(NewTestWorker.get_shoryuken_options['queue']).to eq 'production_default'
117
117
  end
118
118
 
119
+ it 'accepts an array as a queue' do
120
+ class WorkerMultipleQueues
121
+ include Shoryuken::Worker
122
+
123
+ shoryuken_options queue: %w[queue1 queue2 queue3]
124
+ end
125
+
126
+ expect(Shoryuken.worker_registry.workers('queue1')).to eq([WorkerMultipleQueues])
127
+ expect(Shoryuken.worker_registry.workers('queue2')).to eq([WorkerMultipleQueues])
128
+ expect(Shoryuken.worker_registry.workers('queue3')).to eq([WorkerMultipleQueues])
129
+ end
130
+
119
131
  it 'is possible to configure the global defaults' do
120
132
  queue = SecureRandom.uuid
121
133
  Shoryuken.default_worker_options['queue'] = 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: 2.0.2
4
+ version: 2.0.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: 2015-10-27 00:00:00.000000000 Z
11
+ date: 2015-12-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -114,14 +114,14 @@ dependencies:
114
114
  requirements:
115
115
  - - "~>"
116
116
  - !ruby/object:Gem::Version
117
- version: 0.16.0
117
+ version: '0.16'
118
118
  type: :runtime
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
122
  - - "~>"
123
123
  - !ruby/object:Gem::Version
124
- version: 0.16.0
124
+ version: '0.16'
125
125
  description: Shoryuken is a super efficient AWS SQS thread based message processor
126
126
  email:
127
127
  - pablo@pablocantero.com