perfectqueue 0.8.12 → 0.8.13
Sign up to get free protection for your applications and to get access to all the features.
data/ChangeLog
CHANGED
@@ -63,8 +63,13 @@ module PerfectQueue
|
|
63
63
|
def child_heartbeat
|
64
64
|
@wpipe.write HEARTBEAT_PACKET
|
65
65
|
rescue
|
66
|
-
@log.error "Parent process unexpectedly died
|
67
|
-
|
66
|
+
@log.error "Parent process unexpectedly died: #{$!}"
|
67
|
+
force_stop
|
68
|
+
end
|
69
|
+
|
70
|
+
# override
|
71
|
+
def force_stop
|
72
|
+
super
|
68
73
|
Process.kill(:KILL, Process.pid)
|
69
74
|
exit! 137
|
70
75
|
end
|
@@ -27,7 +27,7 @@ module PerfectQueue
|
|
27
27
|
@running_flag = BlockingFlag.new
|
28
28
|
@finish_flag = BlockingFlag.new
|
29
29
|
|
30
|
-
@tm = TaskMonitor.new(config, method(:child_heartbeat))
|
30
|
+
@tm = TaskMonitor.new(config, method(:child_heartbeat), method(:force_stop))
|
31
31
|
|
32
32
|
restart(false, config)
|
33
33
|
end
|
@@ -74,6 +74,12 @@ module PerfectQueue
|
|
74
74
|
@finish_flag.set!
|
75
75
|
end
|
76
76
|
|
77
|
+
def force_stop
|
78
|
+
@log.error "Force stopping processor processor_id=#{@processor_id}"
|
79
|
+
@tm.stop_task(true)
|
80
|
+
@finish_flag.set!
|
81
|
+
end
|
82
|
+
|
77
83
|
def logrotated
|
78
84
|
# do nothing
|
79
85
|
end
|
@@ -19,10 +19,11 @@
|
|
19
19
|
module PerfectQueue
|
20
20
|
|
21
21
|
class TaskMonitor
|
22
|
-
def initialize(config, child_heartbeat=nil)
|
22
|
+
def initialize(config, child_heartbeat=nil, force_stop=nil)
|
23
23
|
@config = config
|
24
24
|
@log = config[:logger]
|
25
25
|
@child_heartbeat = child_heartbeat || Proc.new {}
|
26
|
+
@force_stop = force_stop || Proc.new {}
|
26
27
|
|
27
28
|
@child_heartbeat_interval = (@config[:child_heartbeat_interval] || 2).to_i
|
28
29
|
@task_heartbeat_interval = (@config[:task_heartbeat_interval] || 2).to_i
|
@@ -135,15 +136,16 @@ module PerfectQueue
|
|
135
136
|
end
|
136
137
|
}
|
137
138
|
rescue
|
138
|
-
@log.error "Unknown error #{$!.class}: #{$!}
|
139
|
+
@log.error "Unknown error #{$!.class}: #{$!}"
|
139
140
|
$!.backtrace.each {|bt| @log.warn "\t#{bt}" }
|
141
|
+
@force_stop.call
|
140
142
|
end
|
141
143
|
|
142
144
|
private
|
143
145
|
def task_heartbeat
|
144
146
|
@task.heartbeat! :message => @heartbeat_message
|
145
147
|
@heartbeat_message = nil
|
146
|
-
rescue
|
148
|
+
rescue
|
147
149
|
# finished, cancel_requested, preempted, etc.
|
148
150
|
kill_task($!)
|
149
151
|
end
|
data/lib/perfectqueue/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: perfectqueue
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.13
|
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-08-
|
12
|
+
date: 2012-08-10 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: sequel
|