queue_map 0.5 → 0.6
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.
- data/lib/queue_map/consumer.rb +1 -2
- data/lib/queue_map/version.rb +1 -1
- data/lib/queue_map.rb +0 -1
- metadata +6 -6
data/lib/queue_map/consumer.rb
CHANGED
@@ -106,9 +106,7 @@ class QueueMap::Consumer
|
|
106
106
|
begin
|
107
107
|
Timeout.timeout(job_timeout) do
|
108
108
|
msg = Marshal.load(msg)
|
109
|
-
logger.info { "Received #{msg.inspect} on #{Process.pid}" }
|
110
109
|
result = worker_proc.call(msg[:input])
|
111
|
-
logger.info { "Result #{result.inspect}" }
|
112
110
|
bunny.queue(msg[:response_queue]).publish(Marshal.dump(:result => result, :index => msg[:index]))
|
113
111
|
end
|
114
112
|
ensure
|
@@ -169,6 +167,7 @@ class QueueMap::Consumer
|
|
169
167
|
|
170
168
|
logger.info "#{Process.pid}: stopping (graceful: #{graceful})"
|
171
169
|
if graceful
|
170
|
+
Thread.new { sleep job_timeout; stop(false) } # after job_timeout seconds, force shut down
|
172
171
|
@shutting_down = true
|
173
172
|
else
|
174
173
|
begin
|
data/lib/queue_map/version.rb
CHANGED
data/lib/queue_map.rb
CHANGED
@@ -42,7 +42,6 @@ module QueueMap
|
|
42
42
|
response_queue = bunny.queue(response_queue_name, :durable => false, :exclusive => true, :auto_delete => true)
|
43
43
|
|
44
44
|
(0..(collection.length - 1)).each do |i|
|
45
|
-
puts "Publishing #{collection[i].inspect}."
|
46
45
|
q.publish(Marshal.dump(:input => collection[i], :index => i, :response_queue => response_queue_name))
|
47
46
|
end
|
48
47
|
|
metadata
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: queue_map
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
5
|
-
prerelease:
|
4
|
+
hash: 7
|
5
|
+
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
-
|
9
|
-
version: "0.
|
8
|
+
- 6
|
9
|
+
version: "0.6"
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Tim Harper
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date:
|
17
|
+
date: 2011-06-15 00:00:00 -06:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -126,7 +126,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
126
126
|
requirements: []
|
127
127
|
|
128
128
|
rubyforge_project:
|
129
|
-
rubygems_version: 1.
|
129
|
+
rubygems_version: 1.5.0
|
130
130
|
signing_key:
|
131
131
|
specification_version: 3
|
132
132
|
summary: Map a task across a pool of consumers, and recieve the result when the consumers are done
|