Skip to content

Commit

Permalink
Fixes [mojombogh-129] based on code review from eric.
Browse files Browse the repository at this point in the history
  • Loading branch information
Alan Pinstein committed Sep 7, 2013
1 parent f0866e9 commit 4a8688f
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/god/conditions/process_exits.rb
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

0 comments on commit 4a8688f

Please sign in to comment.