procrastinator 0.6.0 → 0.6.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 085c07da4d7c83dcccb46159c9bad1fc17717013
4
- data.tar.gz: aaa2554edfe76056856da018705a21bef6a5345f
3
+ metadata.gz: 7162a00d304b7e97d03893a92fbe45b11534e305
4
+ data.tar.gz: e6e0fe48cf1cc1940aed6f85ccf889e36d40d0ff
5
5
  SHA512:
6
- metadata.gz: 27cf0c1198f7c0f7e3c1208ff52f93a1c9fa7117ec2dcd8c7433f334cfeefb4b6e3dd43ed126be7058aeb60b7e78038fc3db138588e5eb267346fd7e43c7a0d6
7
- data.tar.gz: cd0a15608dfa630cd70958d1040b06a63e127efca81e08f45642ee4fc427ead3a1ddf0d3f46243752f8a77d265cbcf562ecb2d01b51fed06d97ca1c9159bcfaf
6
+ metadata.gz: 3d23c3bba5d8df4963a7a33cbe70606dba64b86cba3f0c5861d37a9a878728e180bbea1afa196431fef7f2121e2a073cb2450989970a3b1c899378bd82f5a101
7
+ data.tar.gz: b2c35bafb8c18af846ab8199a923ef9bc9d09d81c731c3d9c0b46a7ca7f1ab1c87adf8f9f0ff1768341c86d9a59044b6f94db8230bcba6da15c68f0e849831df
@@ -116,12 +116,12 @@ module Procrastinator
116
116
  def monitor_parent(worker)
117
117
  parent_pid = Process.ppid
118
118
 
119
- heartbeat_thread = Thread.new(parent_pid) do |pid|
119
+ heartbeat_thread = Thread.new(parent_pid) do |ppid|
120
120
  loop do
121
121
  begin
122
- Process.kill(0, pid) # kill(0) will check if the process exists
122
+ Process.kill(0, ppid) # kill with 0 flag checks if the process exists & has permissions
123
123
  rescue Errno::ESRCH
124
- worker.log_parent_exit
124
+ worker.log_parent_exit(ppid: ppid, pid: Process.pid)
125
125
  exit
126
126
  end
127
127
 
@@ -44,7 +44,7 @@ module Procrastinator
44
44
  end
45
45
  rescue StandardError => e
46
46
  @logger.fatal(e)
47
- # raise e
47
+ # raise e
48
48
  end
49
49
  end
50
50
 
@@ -98,10 +98,16 @@ module Procrastinator
98
98
  end
99
99
  end
100
100
 
101
- def log_parent_exit
101
+ # Logs a termination due to parent process termination
102
+ #
103
+ # == Parameters:
104
+ # @param ppid the parent's process id
105
+ # @param pid the child's process id
106
+ #
107
+ def log_parent_exit(ppid:, pid:)
102
108
  raise RuntimeError.new('Cannot log when logger not defined. Call #start_log first.') unless @logger
103
109
 
104
- @logger.error("Terminated worker process (#{Process.pid}) due to main process (#{Process.ppid}) disappearing.")
110
+ @logger.error("Terminated worker process (pid=#{pid}) due to main process (ppid=#{ppid}) disappearing.")
105
111
  end
106
112
  end
107
113
 
@@ -1,3 +1,3 @@
1
1
  module Procrastinator
2
- VERSION = '0.6.0'
2
+ VERSION = '0.6.1'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: procrastinator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robin Miller