lib/pitchfork/children.rb in pitchfork-0.10.0 vs lib/pitchfork/children.rb in pitchfork-0.11.0

- old
+ new

@@ -64,17 +64,25 @@ def nr_alive?(nr) @workers.key?(nr) end + def abandon(worker) + @workers.delete(worker.nr) + @pending_workers.delete(worker.nr) + end + def reap(pid) if child = @children.delete(pid) @pending_workers.delete(child.nr) @pending_molds.delete(child.pid) @molds.delete(child.pid) @workers.delete(child.nr) if @mold == child + @pending_workers.reject! do |nr, worker| + worker.generation == @mold.generation + end @mold = nil end end child end @@ -97,10 +105,14 @@ def molds @molds.values end + def empty? + @children.empty? + end + def each(&block) @children.each_value(&block) end def each_worker(&block) @@ -122,17 +134,9 @@ def hard_kill_all(sig) each do |child| hard_kill(sig, child) end - end - - def hard_timeout(child) - child.hard_timeout! - rescue Errno::ESRCH - reap(child.pid) - child.close - true end def workers @workers.values end