665: def reap_dead_workers(reason='unknown')
666: if @workers.list.length > 0
667: STDERR.puts "#{Time.now}: Reaping #{@workers.list.length} threads for slow workers because of '#{reason}'"
668: error_msg = "Mongrel timed out this thread: #{reason}"
669: mark = Time.now
670: @workers.list.each do |w|
671: w[:started_on] = Time.now if not w[:started_on]
672:
673: if mark - w[:started_on] > @death_time + @timeout
674: STDERR.puts "Thread #{w.inspect} is too old, killing."
675: w.raise(TimeoutError.new(error_msg))
676: end
677: end
678: end
679:
680: return @workers.list.length
681: end