hutch 0.4.4 → 0.4.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 +7 -0
- data/hutch.gemspec +1 -1
- data/lib/hutch/broker.rb +3 -9
- data/lib/hutch/version.rb +1 -1
- data/lib/hutch/worker.rb +10 -3
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 107ee67686b10db84f9e890b9f0f082a2c155b41
|
4
|
+
data.tar.gz: 23465bcdb425ffdd3fe1411d88e91b5817f8aeb1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8ae2a6b72c937256009cab231cc45b3b63b45e9915cdde0ea1d08408c9b4d9560de053d24bb30f72afdd9e72d1687b39bbfe6cbf5aed6246ff96bba903648616
|
7
|
+
data.tar.gz: 915f42a2056f6449693f5b05ff4ae7645231a1d9a42d94760cfe7548f5bb4bf0ed6cb2bce9c897bea4ee33d8ed1c86295ddc6b4f715e30f2448ac472b351f8b4
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,10 @@
|
|
1
|
+
## 0.4.5 - October 15, 2013
|
2
|
+
|
3
|
+
- No exception raised when hutch is run with no consumers. Instead, a warning
|
4
|
+
is logged.
|
5
|
+
- Internal refactoring: use Bunny's shiny `ConsumerWorkPool#threads`
|
6
|
+
attr_reader.
|
7
|
+
|
1
8
|
## 0.4.4 - October 12, 2013
|
2
9
|
|
3
10
|
- Friendlier Message#inspect, doesn't spew out detailed bunny info.
|
data/hutch.gemspec
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
require File.expand_path('../lib/hutch/version', __FILE__)
|
2
2
|
|
3
3
|
Gem::Specification.new do |gem|
|
4
|
-
gem.add_runtime_dependency 'bunny', '
|
4
|
+
gem.add_runtime_dependency 'bunny', '>= 0.10.8'
|
5
5
|
gem.add_runtime_dependency 'carrot-top', '~> 0.0.7'
|
6
6
|
gem.add_runtime_dependency 'multi_json', '~> 1.5'
|
7
7
|
gem.add_development_dependency 'rspec', '~> 2.12.0'
|
data/lib/hutch/broker.rb
CHANGED
@@ -132,15 +132,10 @@ module Hutch
|
|
132
132
|
# Each subscriber is run in a thread. This calls Thread#join on each of the
|
133
133
|
# subscriber threads.
|
134
134
|
def wait_on_threads(timeout)
|
135
|
-
# HACK: work_pool.join doesn't allow a timeout to be passed in, so we
|
136
|
-
# use instance_variable_get to gain access to the threadpool, and
|
137
|
-
# manuall call thread.join with a timeout
|
138
|
-
threads = work_pool_threads
|
139
|
-
|
140
135
|
# Thread#join returns nil when the timeout is hit. If any return nil,
|
141
136
|
# the threads didn't all join so we return false.
|
142
|
-
per_thread_timeout = timeout.to_f /
|
143
|
-
|
137
|
+
per_thread_timeout = timeout.to_f / work_pool_threads.length
|
138
|
+
work_pool_threads.none? { |thread| thread.join(per_thread_timeout).nil? }
|
144
139
|
end
|
145
140
|
|
146
141
|
def stop
|
@@ -167,8 +162,7 @@ module Hutch
|
|
167
162
|
private
|
168
163
|
|
169
164
|
def work_pool_threads
|
170
|
-
|
171
|
-
@channel.work_pool.instance_variable_get(:@threads)
|
165
|
+
@channel.work_pool.threads || []
|
172
166
|
end
|
173
167
|
|
174
168
|
def generate_id
|
data/lib/hutch/version.rb
CHANGED
data/lib/hutch/worker.rb
CHANGED
@@ -8,9 +8,8 @@ module Hutch
|
|
8
8
|
include Logging
|
9
9
|
|
10
10
|
def initialize(broker, consumers)
|
11
|
-
@broker
|
12
|
-
|
13
|
-
@consumers = consumers
|
11
|
+
@broker = broker
|
12
|
+
self.consumers = consumers
|
14
13
|
end
|
15
14
|
|
16
15
|
# Run the main event loop. The consumers will be set up with queues, and
|
@@ -100,5 +99,13 @@ module Hutch
|
|
100
99
|
backend.handle(message_id, consumer, ex)
|
101
100
|
end
|
102
101
|
end
|
102
|
+
|
103
|
+
def consumers=(val)
|
104
|
+
if val.empty?
|
105
|
+
logger.warn 'no consumer loaded, ensure there\'s' +
|
106
|
+
'no configuration issue'
|
107
|
+
end
|
108
|
+
@consumers = val
|
109
|
+
end
|
103
110
|
end
|
104
111
|
end
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hutch
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Harry Marr
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-10-
|
11
|
+
date: 2013-10-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bunny
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.10.
|
19
|
+
version: 0.10.8
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.10.
|
26
|
+
version: 0.10.8
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: carrot-top
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|