Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion lib/god/conditions/process_exits.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ def valid?
end

def pid
self.pid_file ? File.read(self.pid_file).strip.to_i : self.watch.pid
# only read pid once since lazy evaluation can cause bugs due to changing external state
@pid ||= self.pid_file ? File.read(self.pid_file).strip.to_i : self.watch.pid
end

def register
Expand All @@ -50,6 +51,8 @@ def register

def deregister
pid = self.pid
@pid = nil # reset so that @pid will bootstrap itself again as needed

if pid
EventHandler.deregister(pid, :proc_exit)

Expand Down