frenzy_bunnies 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/frenzy_bunnies/version.rb +1 -1
- data/lib/frenzy_bunnies/worker.rb +11 -5
- metadata +3 -2
@@ -25,6 +25,7 @@ module FrenzyBunnies::Worker
|
|
25
25
|
|
26
26
|
@queue_opts[:prefetch] ||= 10
|
27
27
|
@queue_opts[:durable] ||= false
|
28
|
+
@queue_opts[:timeout_job_after] ||=5
|
28
29
|
|
29
30
|
if @queue_opts[:threads]
|
30
31
|
@thread_pool = Executors.new_fixed_thread_pool(@queue_opts[:threads])
|
@@ -40,12 +41,17 @@ module FrenzyBunnies::Worker
|
|
40
41
|
@s.each(:blocking => false, :executor => @thread_pool) do |h, msg|
|
41
42
|
wkr = new
|
42
43
|
begin
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
44
|
+
Timeout::timeout(@queue_opts[:timeout_job_after]) do
|
45
|
+
if(wkr.work(msg))
|
46
|
+
h.ack
|
47
|
+
else
|
48
|
+
h.reject
|
49
|
+
error "Cannot process message <#{msg.inspect}>"
|
50
|
+
end
|
48
51
|
end
|
52
|
+
rescue Timeout::Error
|
53
|
+
h.reject
|
54
|
+
error "TIMEOUT #{@queue_opts[:timeout_job_after]} seconds have elapsed: #{$!}"
|
49
55
|
rescue
|
50
56
|
h.reject
|
51
57
|
error "ERROR #{$!}"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: frenzy_bunnies
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-08-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: hot_bunnies
|
@@ -92,3 +92,4 @@ signing_key:
|
|
92
92
|
specification_version: 3
|
93
93
|
summary: RabbitMQ JRuby based workers on top of hot_bunnies
|
94
94
|
test_files: []
|
95
|
+
has_rdoc:
|