class Puma::Cluster::WorkerHandle

:nodoc:
see Puma::Cluster::Worker.
include the actual logic executed by the worker process itself. For that,
and it exposes methods to control the process via IPC. It does not
master process. It contains information about the process and its health
This class represents a worker process from the perspective of the puma

def boot!

def boot!
  @last_checkin = Time.now
  @stage = :booted
end

def booted?

def booted?
  @stage == :booted
end

def hup

def hup
  Process.kill "HUP", @pid
rescue Errno::ESRCH
end

def initialize(idx, pid, phase, options)

def initialize(idx, pid, phase, options)
  @index = idx
  @pid = pid
  @phase = phase
  @stage = :started
  @signal = "TERM"
  @options = options
  @first_term_sent = nil
  @started_at = Time.now
  @last_checkin = Time.now
  @last_status = {}
  @term = false
  @worker_max = Array.new WORKER_MAX_KEYS.length, 0
end

def kill

def kill
  @signal = 'KILL'
  term
end

def ping!(status)

def ping!(status)
  hsh = {}
  k, v = nil, nil
  status.tr('}{"', '').strip.split(", ") do |kv|
    cntr = 0
    kv.split(':') do |t|
      if cntr == 0
        k = t
        cntr = 1
      else
        v = t
      end
    end
    hsh[k.to_sym] = v.to_i
  end
  # check stat max values, we can't signal workers to reset the max values,
  # so we do so here
  WORKER_MAX_KEYS.each_with_index do |key, idx|
    if hsh[key] < @worker_max[idx]
      hsh[key] = @worker_max[idx]
    else
      @worker_max[idx] = hsh[key]
    end
  end
  @last_checkin = Time.now
  @last_status = hsh
end

def ping_timeout

Other tags:
    Version: - 5.0.0

Other tags:
    See: Puma::Cluster#check_workers -
def ping_timeout
  @last_checkin +
    (booted? ?
      @options[:worker_timeout] :
      @options[:worker_boot_timeout]
    )
end

def reset_max

Resets max values to zero. Called whenever `Cluster#stats` is called
def reset_max
  WORKER_MAX_KEYS.length.times { |idx| @worker_max[idx] = 0 }
end

def term

def term
  begin
    if @first_term_sent && (Time.now - @first_term_sent) > @options[:worker_shutdown_timeout]
      @signal = "KILL"
    else
      @term ||= true
      @first_term_sent ||= Time.now
    end
    Process.kill @signal, @pid if @pid
  rescue Errno::ESRCH
  end
end

def term!

def term!
  @term = true
end

def term?

def term?
  @term
end

def uptime

def uptime
  Time.now - started_at
end