perfectqueue 0.8.25 → 0.8.26

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/ChangeLog CHANGED
@@ -1,4 +1,11 @@
1
1
 
2
+ == 2014-03-27 version 0.8.26
3
+
4
+ * Added delay before sending KILL signal to worker process when
5
+ a heartbeat pipe is closed or stopped
6
+ * Added child_heartbeat_kill_delay parameter
7
+
8
+
2
9
  == 2014-02-18 version 0.8.25
3
10
 
4
11
  * rdb_compat: submit method supports :compression => 'gzip' option
@@ -43,16 +43,20 @@ module PerfectQueue
43
43
  return Time.now.to_i - @last_heartbeat <= limit
44
44
  end
45
45
 
46
- def start_killing(immediate)
46
+ def start_killing(immediate, delay=0)
47
47
  if immediate && !@kill_immediate
48
48
  @kill_immediate = true # escalation
49
49
  elsif @kill_start_time
50
50
  return
51
51
  end
52
52
 
53
- now = Time.now.to_i
54
- kill_child(now, nil)
55
- @kill_start_time = now
53
+ if delay == 0
54
+ now = Time.now.to_i
55
+ kill_child(now, nil)
56
+ @kill_start_time = now
57
+ else
58
+ @kill_start_time = now + delay
59
+ end
56
60
  end
57
61
 
58
62
  def killing_status
@@ -72,7 +76,7 @@ module PerfectQueue
72
76
 
73
77
  begin
74
78
  if Process.waitpid(@pid, Process::WNOHANG)
75
- @log.info "Processor exited pid=#{@pid}"
79
+ @log.info "Processor exited and joined pid=#{@pid}"
76
80
  return true
77
81
  end
78
82
  rescue Errno::ECHILD
@@ -37,6 +37,7 @@ module PerfectQueue
37
37
  @child_kill_interval = config[:child_kill_interval] || 2.0
38
38
  @child_graceful_kill_limit = config[:child_graceful_kill_limit] || nil
39
39
  @child_fork_frequency_limit = config[:child_fork_frequency_limit] || 5.0
40
+ @child_heartbeat_kill_delay = config[:child_heartbeat_kill_delay] || 10
40
41
  @log = config[:logger]
41
42
  @config = config # for child process
42
43
 
@@ -71,11 +72,11 @@ module PerfectQueue
71
72
  end
72
73
  rescue EOFError
73
74
  @log.error "Heartbeat pipe is closed. Restarting child process id=#{@processor_id} pid=#{c.pid}."
74
- c.start_killing(true)
75
+ c.start_killing(true, @child_heartbeat_kill_delay)
75
76
  rescue
76
77
  @log.error "Unknown error: #{$!.class}: #{$!}: Restarting child process id=#{@processor_id} pid=#{c.pid}."
77
78
  $!.backtrace.each {|bt| @log.warn "\t#{bt}" }
78
- c.start_killing(false)
79
+ c.start_killing(true, @child_heartbeat_kill_delay)
79
80
  end
80
81
  end
81
82
 
@@ -1,3 +1,3 @@
1
1
  module PerfectQueue
2
- VERSION = "0.8.25"
2
+ VERSION = "0.8.26"
3
3
  end
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.25
4
+ version: 0.8.26
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: 2014-02-18 00:00:00.000000000 Z
12
+ date: 2014-03-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: sequel