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 +4 -4
- data/lib/procrastinator/environment.rb +3 -3
- data/lib/procrastinator/queue_worker.rb +9 -3
- data/lib/procrastinator/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7162a00d304b7e97d03893a92fbe45b11534e305
|
4
|
+
data.tar.gz: e6e0fe48cf1cc1940aed6f85ccf889e36d40d0ff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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 |
|
119
|
+
heartbeat_thread = Thread.new(parent_pid) do |ppid|
|
120
120
|
loop do
|
121
121
|
begin
|
122
|
-
Process.kill(0,
|
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
|
-
|
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
|
-
|
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 (
|
110
|
+
@logger.error("Terminated worker process (pid=#{pid}) due to main process (ppid=#{ppid}) disappearing.")
|
105
111
|
end
|
106
112
|
end
|
107
113
|
|