class Puma::Cluster

def check_workers

def check_workers
  return if @next_check >= Time.now
  @next_check = Time.now + @options[:worker_check_interval]
  timeout_workers
  wait_workers
  cull_workers
  spawn_workers
  if all_workers_booted?
    # If we're running at proper capacity, check to see if
    # we need to phase any workers out (which will restart
    # in the right phase).
    #
    w = @workers.find { |x| x.phase != @phase }
    if w
      log "- Stopping #{w.pid} for phased upgrade..."
      unless w.term?
        w.term
        log "- #{w.signal} sent to #{w.pid}..."
      end
    end
  end
  t = @workers.reject(&:term?)
  t.map!(&:ping_timeout)
  @next_check = [t.min, @next_check].compact.min
end